
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}//END OF FUNCTION

function dosearch() {//FOR THE SEARCH FOR ON THE FRONT PAGE
var sf=document.searchform;
var submitto = sf.sengines.options[sf.sengines.selectedIndex].value + escape(sf.searchterms.value);
window.location.href = submitto;
return false;
}

var pImage=new Array();//STORES THE IMAGE ARRAY FOR THE PROFILE PAGE
pImage[0]='images/close.gif';
pImage[1]='images/open.gif';

var image=new Array();//STORES THE IMAGE ARRAY FOR THE SHOP
image[0]= new Array();
image[1]= new Array();
image[2]= new Array();image[3]= new Array();image[4]= new Array();image[5]= new Array();image[6]= new Array();image[7]= new Array();image[8]= new Array();image[9]= new Array();image[10]= new Array();image[11]= new Array();image[12]= new Array();image[13]= new Array();image[14]= new Array();image[15]= new Array();image[16]= new Array();image[17]= new Array();image[18]= new Array();
image[0][0]='images/shirts/shirtdesigner_graphic.php.png';
image[0][1]='TLA-SHOP';//'£9.99';
image[1][0]='images/shirts/shirtdesigner_graphic16.php.png';
image[1][1]='TLA-SHOP';//'£10.99';
image[2][0]='images/shirts/shirtdesigner_graphic2.php.png';
image[2][1]='TLA-SHOP';//'£20.99';
image[3][0]='images/shirts/shirtdesigner_text3.php.png';
image[3][1]='TLA-SHOP';
image[4][0]='images/shirts/shirtdesigner_text4.php.png';
image[4][1]='TLA-SHOP';
image[5][0]='images/shirts/shirtdesigner_text5.php.png';
image[5][1]='TLA-SHOP';
image[6][0]='images/shirts/shirtdesigner_text6.php.png';
image[6][1]='TLA-SHOP';
image[7][0]='images/shirts/shirtdesigner_text7.php.png';
image[7][1]='TLA-SHOP';
image[8][0]='images/shirts/shirtdesigner_text8.php.png';
image[8][1]='TLA-SHOP';
image[9][0]='images/shirts/shirtdesigner_text9.php.png';
image[9][1]='TLA-SHOP';
image[10][0]='images/shirts/shirtdesigner_text10.php.png';
image[10][1]='TLA-SHOP';
image[11][0]='images/shirts/shirtdesigner_graphic.php.png';
image[11][1]='TLA-SHOP';
image[12][0]='images/shirts/shirtdesigner_text12.php.png';
image[12][1]='TLA-SHOP';
image[13][0]='images/shirts/shirtdesigner_text13.php.png';
image[13][1]='TLA-SHOP';
image[14][0]='images/shirts/shirtdesigner_text14.php.png';
image[14][1]='TLA-SHOP';
image[15][0]='images/shirts/shirtdesigner_text15.php.png';
image[15][1]='TLA-SHOP';
image[16][0]='images/shirts/shirtdesigner_text12.php.png';
image[16][1]='TLA-SHOP';
image[17][0]='images/shirts/shirtdesigner_text17.php.png';
image[17][1]='TLA-SHOP';
image[18][0]='images/shirts/shirtdesigner_text18.php.png';
image[18][1]='TLA-SHOP';

var currentImgNumber=0;
var numberOfImages=image.length;

function window_onload()
{//SETS THE TIMER

   setTimeout("switchImage()",3000);
}


function switchImage()
{//FOR ALTERING THE IMAGES ON THE FRONT PAGE
   document.getElementById('tlaClothDesc').firstChild.nodeValue=image[currentImgNumber][1];
   document.imgAdvert.src = image[currentImgNumber][0];
//"AdvertImage" + currentImgNumber + ".jpg";
    currentImgNumber++;
  if (currentImgNumber==18){//resets the counter
currentImgNumber=0;
}
   if (currentImgNumber < numberOfImages)   {
      setTimeout("switchImage()",3000);   
      }
}


// Set bSupportsDHTML to true for Internet Explorer 4 or later USED TO HIDE THINGS
var bDoesDHTML = ( (navigator.userAgent.indexOf("MSIE") >= 0) &&
                   (navigator.appVersion.substring(0,1) >= 4) )

// Only hide menu items if browser supports DHTML
if(0){//NO LONGER RELEVANT AS STYLE DEFINED IN STYLE SHEET
//document.write("<STYLE>.off{display:none}</STYLE>")
}

function doSection(secNum){
  if (1){
    //display the section if hidden; hide it if it is displayed
    if (secNum.className=="off"){secNum.className="on"} 
    else{secNum.className="off"}
  }
}


function toggle( elemID )
{//FOR HIDING ELEMENTS USED IN THE PROFILE PAGE
	var elem = document.getElementById( elemID );
	if( elem.style.position != 'absolute' )
	{
		elem.style.position = 'absolute';
		elem.style.left = '-4000px';
	}
	else
	{
		elem.style.position = 'relative';
		elem.style.left = '0px';
	}
}

function change(elemID){//FOR TURNING THINGS ON AND OFF
var elem= document.getElementById(elemID);
if (elem.style.display =="" || elem.style.display == 'none')
{
elem.style.display = 'block';
}else{
elem.style.display = 'none';
}
}//END OF FUNCTION


var IFrameObj; // our IFrame object

function callToServer(theFormName) {
  if (!document.createElement) {return true;}
  var IFrameDoc;
      var URL = 'albumServer.php' + buildQueryString(theFormName);
  if (!IFrameObj && document.createElement) {
    // create the IFrame and assign a reference to the
    // object to our global variable IFrameObj.
    // this will only happen the first time 
    // callToServer() is called
   try {
      var tempIFrame=document.createElement('iframe');
      tempIFrame.setAttribute('id','RSIFrame');
      tempIFrame.style.border='0px';
      tempIFrame.style.width='0px';
      tempIFrame.style.height='0px';
      IFrameObj = document.body.appendChild(tempIFrame);
      
      if (document.frames) {
        // this is for IE5 Mac, because it will only
        // allow access to the document object
        // of the IFrame if we access it through
        // the document.frames array
        IFrameObj = document.frames['RSIFrame'];
      }
    } catch(exception) {
      // This is for IE5 PC, which does not allow dynamic creation
      // and manipulation of an iframe object. Instead, we'll fake
      // it up by creating our own objects.
      iframeHTML='\<iframe id="RSIFrame" style="';
      iframeHTML+='border:0px;';
      iframeHTML+='width:0px;';
      iframeHTML+='height:0px;';
      iframeHTML+='"><\/iframe>';
      document.body.innerHTML+=iframeHTML;
      IFrameObj = new Object();
      IFrameObj.document = new Object();
      IFrameObj.document.location = new Object();
      IFrameObj.document.location.iframe = document.getElementById('RSIFrame');
      IFrameObj.document.location.replace = function(location) {
        this.iframe.src = location;
      }
    }
  }
  
  if (navigator.userAgent.indexOf('Gecko') !=-1 && !IFrameObj.contentDocument) {
    // we have to give NS6 a fraction of a second
    // to recognize the new IFrame
    setTimeout('callToServer()',10);


    return false;
  }
  
  if (IFrameObj.contentDocument) {
    // For NS6
    IFrameDoc = IFrameObj.contentDocument; 
  } else if (IFrameObj.contentWindow) {
    // For IE5.5 and IE6
    IFrameDoc = IFrameObj.contentWindow.document;
  } else if (IFrameObj.document) {
    // For IE5
    IFrameDoc = IFrameObj.document;
  } else {
    return true;
  }
  
  IFrameDoc.location.replace(URL);//THIS IS WHERE THE ACTUALLY IFRAME URL IS CHANGE FOR GET
   
  //WE HAVE TO DYNAMICALLY, INSERT A FORM INTO THE IFRAME AND SUBMIT IT.
// IN THE GET, A SERVER PAGE IS OPENED IN THE CREATED IFRAME AND ITS SOURCE CHANGED,
// BUT IN POSTING, A FORM IN CREATED IN THE CREATED IFRAME AND THE IFRAME FORM IS SUBMITED TO THE SERVER PAGE

// IFrameDoc.body.innerHTML='PUT YOUR FORM HERE AND POST TO SERVER(.PHP) PAGE';
 
// WITH AN ONLOAD EVENT THAT FIRES AFTER THE PAGE HAS BE LOADED IN THE IFRAME.


  return false;
}


function buildQueryString(theFormName) {//WHEN SENT A FORM NAME, GETS THE FORM ELEMENTS AND BUILDS A STRING
  theForm = document.forms[theFormName];
  var qs = ''
  for (e=0;e<theForm.elements.length;e++) {
    if (theForm.elements[e].name!='') {
      qs+=(qs=='')?'?':'&'
      qs+=theForm.elements[e].name+'='+escape(theForm.elements[e].value)
      }
    }

//alert(qs);

  return qs;
}

function ajax(Responsemsg){
//var iFrame=document.getElementById("iFrame");
//if(iFrame) {return true;}
//var iFrameBody = document.getElementById("iFrame").contentWindow.document.body;
//iFrameBody.innerHTML = "THIS IS THE IFRAME CONTENT";
//var serverResponses=iFrameBody.innerHTML;
//iFrame.src="ajax.php?data1=lovers";
document.getElementById('response').firstChild.nodeValue=Responsemsg;//serverResponses;
//document.write(serverResponses);
}

//END OF AJAX FUNCTIONALITY

//USED BY ABLUM GALLERY TO SWAP IMAGES AND CHANGE DESCRIPTION
function imgSrcSwap(title,id){
var mainImgSrc=document.mainImg;
var pic_id=id;lastId=id;
var elemId=document.getElementById('description');
elemId.firstChild.nodeValue='--> '+title;
mainImgSrc.src="f/resize_image.php?uid="+ pic_id +"&max_width=500&max_height=350";
//return true;
}

//USED BY EVENT ABLUM GALLERY TO SWAP IMAGES AND CHANGE DESCRIPTION FOR THE EVENTS PICS
var adjustWidths=500; var adjustHeights=450; var lastId=0;
function imgSrcSwap2(title,id){
var pic_id=id;lastId=id;
var elemId=document.getElementById('description');
elemId.firstChild.nodeValue='--> '+title;
var mainImgSrc=document.mainImg;
//alert(mainImgSrc.width);alert(adjustWidths);
if(pic_id!=0){
mainImgSrc.src="f/resize_image2.php?uid="+ pic_id +"&max_width="+adjustWidths+"&max_height="+adjustHeights+"";
}
//mainImgSrc.src="f/resize_image2.php?uid="+ pic_id +"&max_width=500&max_height=450";
//return false;
}

//USED BY GROUP ABLUM GALLERY TO SWAP IMAGES AND CHANGE DESCRIPTION FOR THE GROUP PICS
var adjustWidths=500; var adjustHeights=450; var glastId=0;
function imgSrcSwap3(title,id){
var pic_id=id;glastId=id;
var elemId=document.getElementById('description');
elemId.firstChild.nodeValue='--> '+title;
var mainImgSrc=document.mainImg;
//alert(mainImgSrc.width);alert(adjustWidths);
if(pic_id!=0){
mainImgSrc.src="f/resize_image3.php?uid="+ pic_id +"&max_width="+adjustWidths+"&max_height="+adjustHeights+"";
}
//mainImgSrc.src="f/resize_image2.php?uid="+ pic_id +"&max_width=600&max_height=450";
return false;
}


function minusWidth(which){//TO REDUCE THE WIDTH OF A THE PICTURE
var which=which;
if(adjustWidths>200){
adjustWidths=adjustWidths-100;
if(which==1){//IF WANTS TO REDUCE THE GROUP GALLERY PIC
imgSrcSwap3('Image width reduced.',glastId);
}else{//IF WANTS TO REDUCE THE GROUP GALLERY PIC
imgSrcSwap2('Image width reduced.',lastId);
}

}else{
confirm('Mimimum size reached');
}
}//END OF FUNCTION

function plusWidth(which){//TO INCEASE THE WIDTH OF A PICTURE
var which=which;
if(adjustWidths<=600){
adjustWidths=adjustWidths+100;
if(which==1){//IF WANTS TO INCREASE THE GROUP GALLERY PIC
imgSrcSwap3('Image width increased.',glastId);
}else{//IF WANTS TO INCREASE THE GROUP GALLERY PIC
imgSrcSwap2('Image width increased.',lastId);
}


}else{
confirm('Maximum size reached');
}
}//END OF FUNCTION




function addLink(){//converts string to webadress
var weblink=" ";
weblink=prompt('EXAMPLE: www.thelordarmy.com',' ');
if(weblink==" "){
if(confirm('Empty Link. Do you want to continue')){
addLink();//RUN FUNCTION AGAIN
}
}else {
if(document.getElementById('link')){
var link=document.getElementById('link');
weblink='http://'+weblink;
//var hrefr=document.createElement('a');
//var website=hrefr.appendChild(weblink);
//link.parentNode.appendChild(weblink);
link.firstChild.nodeValue=weblink;
}else{
document.eventform.description='http://'+weblink;
}

}
 return;
}


