function initialiseBanners(){
	leftBanner = document.getElementById('divLeftBanner');
	content = document.getElementById('divContent');
	body = document.getElementById('tempBody');

	leftBanner.style.height = (document.body.clientHeight - 150)+ 'px';
	content.style.height = (document.body.clientHeight - 150)+ 'px';
	content.style.width = (document.body.clientWidth - 165)+ 'px';	
	
	body.onresize = function() {
		leftBanner.style.height = (document.body.clientHeight - 150)+ 'px';
		content.style.height = (document.body.clientHeight - 150)+ 'px';
		content.style.width = (document.body.clientWidth - 165)+ 'px';
	}		
}


currentNo = 0;   //denote unassigned
TOT_IMAGES = 4;


function PhoneModelChanged(){			
	var samsung = new Array("D500","D600","ZV50","Z540V");
	var nokia = new Array("6151","6230","6280","6680","N73");
	var erickson = new Array("K750i","K300i","K800i");
	var imate = new Array("K-Jam");
	var htc = new Array("TYTN");

	var phoneModels = new Array(samsung,nokia,erickson,imate,htc);
	
	selPhoneMakeElement = document.getElementById('selPhoneMake');
	selPhoneModelElement = document.getElementById('selPhoneModel');
	tmpModels = "";
	
	//remove all models in list		
	while (selPhoneModelElement.hasChildNodes())
	{
		selPhoneModelElement.removeChild(selPhoneModelElement.firstChild);
	}
	
	
	if(selPhoneMakeElement.selectedIndex > 0){
		for(i=0;i<phoneModels[selPhoneMakeElement.selectedIndex -1].length; i++){
			opt = document.createElement("option");
			optText = document.createTextNode((phoneModels[selPhoneMakeElement.selectedIndex -1])[i]);
			opt.appendChild(optText);
			selPhoneModelElement.appendChild(opt);
		}			
	}
}



function tempo(){	
	var tmpMarqueDiv = document.getElementById('divMarque');
	text = tmpMarqueDiv.innerText;	
	var tmpStr = "";
	var index = 0;
	
	while (tmpMarqueDiv.hasChildNodes())
	{
		tmpMarqueDiv.removeChild(tmpMarqueDiv.firstChild);
	}
		
	addNextChar(text, index);
	
}
	

function addNextChar(text, index){					
		if(index < text.length){			
			tmpMarqueDiv.innerText += text.charAt(index);
			index++;			
		}
		
		setTimeout('addNextChar(text, index)',1000);			
}	
	
function dislayGaleryImage(imgTag,show){
	imgPlaceHolder = document.getElementById('imgGalleryDisp');
	imageThumbails = document.getElementById('tblGallery').getElementsByTagName('img');
	var pathParts = imgTag.getAttribute('src').split('/');  //split the image path		
	var imgFileName = pathParts[pathParts.length - 1];   //get the thumbnail file name
	lastpos = imgTag.getAttribute('src').indexOf('thumbnail');
	
	if(show == true){				
		bigImagePath = imgTag.getAttribute('src').substring(0,lastpos) + imgFileName;
		imgPlaceHolder.src = bigImagePath;
		imgPlaceHolder.setAttribute("src",bigImagePath);		
		imgTag.style.border = "2px solid blue";
		for(i=0; i<imageThumbails.length; i++){
			if(imageThumbails[i] != imgTag){				
				imageThumbails[i].style.border = "0px solid blue";
			}
		}	
	}
	else{
		//imgTag.setAttribute('border','0');
		//imgPlaceHolder.setAttribute('src',imgGalleryPlaceHolder);
	}
	
}

/*
function liveChat()
{
    window.open('http://ts-office04/turfsportweb/PureChat.aspx?r=' + escape(document.location.href), '_blank','width=600,height=750,resizable=0,scrollbars=no,toolbar=no,location=no,directories=no,status=yes,menubar=no,copyhistory=no,personalbar=no');
  //window.open('operator/purechatoperator.aspx','Live Chat','width=996,height=700,toolbar=no,location=no,directories=no,menubar=no,status=no');
}
*/
//<div id="pc_I_d" style="cursor: pointer"></div>
//<div id="pc_S_d" style="display: none"></div>
//pc_a_s();
//alert(escape(document.location.href));
/*  var o_h = '';
  function pc_a_s() {
    var t_u = 'ts-office04';
    var pc_b = '';
    //var s_d = document.getElementById("pc_S_d");
    //if (!s_d)
    //  return;
  
    var st = document.createElement('script');
    st.src = pc_b + 'PureChatResourceHandler.ashx?h=' + escape(t_u) + '&zzz=' + new Date().getTime().toString();
  // alert(st.src);
    st.type = "text/javascript";
    while (s_d.childNodes.length > 0) {
      s_d.removeChild(s_d.childNodes[0]);
    }
    s_d.appendChild(st);
  }
 // window.setTimeout('pc_a_s();', 5);
 */


/*
function pc_ow()
{var r_u = ''; 
  try 
   { r_u = escape(document.location.href); } 
  catch(err)
   { r_u = ''; }
   window.open('http://ts-office04/turfsportweb/PureChat.aspx?r=' + r_u, '_blank','width=500,height=600,resizable=0,scrollbars=yes,toolbar=no,location=no,directories=no,status=yes,menubar=no,copyhistory=no,personalbar=no'); }
*/
//run once the DOM is fully loaded and ready to be manipulated
$(document).ready(function(){readXML();}//if you don't have a jquery libray you can include this method::readXML() on your body onload
               )//end document ready  

var OrderedArray = new Array();

function readXML()
   {                  
     try                  
       {                  
         var req = null;                  
                           
//         document.getElementById("divActiveImgPanel").innerHTML ="Started...";                    
                           
         if(window.XMLHttpRequest)                    
         req = new XMLHttpRequest();                    
         else if (window.ActiveXObject)                    
         req  = new ActiveXObject(Microsoft.XMLHTTP);                    
         var numofImgElements = 0;
         var isFlashFile = false;
     
         req.onreadystatechange = function()                    
                                    {                    
//                                      document.getElementById("divActiveImgPanel").innerHTML ="Wait server...";                    
                                      if(req.readyState == 4)                    
                                        {                    
                                          if(req.status == 200)                    
                                            {                    
                                              var xmlDoc = req.responseXML; 
                                              var isOperatorOnline = xmlDoc.getElementsByTagName('isChatMonitored')[0].childNodes[0].nodeValue;
                                              
                                              if(isOperatorOnline != 1)
                                              {
                                                document.getElementById('pureChatLink').style.display = 'none';
                                              }                                              
                                            }                    
                                          else                    
                                            {                    
                                              throw("Error: returned status code " + req.status + " " + req.statusText);                  
                                            }                    
                                        }                    
                                    };//end onreadystatechange                  
         req.open("GET", "operatorLog.xml", true);                    
         req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                    
         req.send(null);                    
       }//end try catch                    
     catch(err)                    
       {                    
         alert(err);                    
       }                      
  }//end funtion  
