var ALLOWAUDIO=true;
var loadVideoIntervalCheck;
var loadVideoFile='';
var newvideostate='';

var currentlistenprodid='';

var CONTENTPLAYING="";



function getPlayer ()
{
	if (navigator.appName=="Microsoft Internet Explorer")
	{
		player = document.getElementById('vplayer2');
		if (!player) player = document.getElementById('vplayer');
	} else if(navigator.appName=="Netscape"&!navigator.appVersion.split("Chrome")[1]&!navigator.appVersion.split("Safari")[1]) {
		player = document.getElementById('vplayer2');
		if (!player) player = document.getElementById('vplayer');
	} else {
		player = document.getElementById('vplayer');
	}
	return player;
}
function loadVideo (file)
{
	loadVideoFile=file;
	loadVideoIntervalCheck=window.setInterval(doLoadVideo,250);
}
function doLoadVideo ()
{
	clearInterval(loadVideoIntervalCheck);
	getPlayer().sendEvent('STOP','true');
	getPlayer().sendEvent('LOAD',loadVideoFile);
	getPlayer().sendEvent('PLAY','true');
}
function frontpageHideVideo ()
{
	
	try
	{
		getPlayer().sendEvent('STOP','true');
	} catch (e) {}
	currentlistenprodid='';
	$('frontpage_video').style.width='1px';
	$('frontpage_video').style.height='1px';

	if (previouswatchbitprodid!="")
	{
		$('watchbit_'+previouswatchbitprodid).innerHTML='Watch';
		previouswatchbitprodid='';
	}
}
var initvidinterval;
function initVideo ()
{
	initvidinterval=window.setInterval("initVideoDo()",200);
}

function initVideoDo ()
{
	clearInterval(initvidinterval);
	try {
		getPlayer().addControllerListener("PLAY","videoPlaying");
		getPlayer().addControllerListener("STOP","videoStopped");
		getPlayer().addModelListener("STATE","videoStatusCheck");
	} catch (e) {
		initvidinterval=window.setInterval("initVideoDo()",200);
	}
}
function listennosound(prodid,clipid,title,href)
{
	clearInterval(loadVideoIntervalCheck);
	clearTimeout(clrListen);
	if (ALLOWAUDIO==true)
	{
		//if (currentlistenprodid!=clipid)
		//{
			frontpageHideVideo();
			currentlistenprodid=clipid;
			CONTENTPLAYING="audio";
			
			$('frontpage_audio').style.display='';
			$('frontpage_audio').style.background='url(/csp/ltgl/goodlife/products/550/'+prodid+'_1.jpg)';
			$('frontpage_audio').style.backgroundRepeat='no-repeat';
			$('frontpage_audio').href=href;
			//$('listendiv'+prodid).style.backgroundPosition="0px -41px";
			$('firstAdProdDescription').innerHTML=title;
			$('frontpage_video_inner').style.left='0px';
			$('frontpage_video_inner').style.top='-312px';
			$('frontpage_video').style.width='550px';
			$('frontpage_video').style.height='1px';
			/*$('frontpage_video_inner').style.left='0px';
			$('frontpage_video_inner').style.top='0px';
			$('frontpage_video').style.width='550px';
			$('frontpage_video').style.height='340px';*/
		//}		
	}
}
function outlistennosound()
{
	clearInterval(loadVideoIntervalCheck);
	if (ALLOWAUDIO==true)
	{
		clrListen=setTimeout(outlistendonosound,100);
		outlistendonosound();
	}
}
function outlistendonosound ()
{
	clearInterval(loadVideoIntervalCheck);
	if (CONTENTPLAYING=="audio")
	{
		var el = getElementsByClass(document,'eachOfferInfo','div');
		for(i=0;i<el.length;i++)
		{
			$('listendiv'+el[i].id.split("eachOfferInfo")[1]).style.backgroundPosition="0px 0px";	
			el[i].style.display='none';
		}
		frontpageHideVideo();
/*		clearAJAXPopUp();*/
	}
}
	
function videoPlaying() { if (CONTENTPLAYING=="video") { ALLOWAUDIO=false; } }
function videoStopped() { ALLOWAUDIO=true; }
function videoStatusCheck (s)
{
	newvideostate=s.newstate;
	
	if (CONTENTPLAYING=="video")
	{
		if (s.newstate=="COMPLETED") ALLOWAUDIO=true;
		if (s.newstate=="PLAY") ALLOWAUDIO=false;
		if (s.newstate=="BUFFERING") ALLOWAUDIO=false;
	}
	
	if (CONTENTPLAYING=="audio")
	{
		;
		if (s.newstate=="STOP") currentlistenprodid='';
		if (s.newstate=="COMPLETED") currentlistenprodid='';
	}
}
function frontpageShowVideo ()
{
	$('frontpage_video').style.width='550px';
	$('frontpage_video').style.height='332px';
	$('frontpage_video_inner').style.left='0px';
	$('frontpage_video_inner').style.top='0px';
	try {
		$('frontpage_audio').style.display='none';
	} catch(e){}
	ALLOWAUDIO=false;
}
function videoVirtPos() {
	if(navigator.appVersion.indexOf('MSIE 6.')>-1) {
		if(window.pageYOffset) {
			ScrollTop = window.pageYOffset;
		} else {
			ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
		}
		$('frontpage_video').style.top	=	parseFloat(ScrollTop+100)+'px';
	}
}

var videoPlaying;
function closeVid() {
	hideFullScreen();
	$('frontpage_video').style.overflow='';
	$('frontpage_video').style.left='0px';
	$('frontpage_video').style.height='0px';
	$('frontpage_video').style.width='0px';
	getPlayer().sendEvent('STOP','true');
}
var previouswatchbitprodid='';
function watchvid(prodid,watchbit,fullScreen)
{
	CONTENTPLAYING="video";
	if ($('watchbit_'+watchbit)||(fullScreen==1))
	{
		if (fullScreen == 1) {
			var ajax = new ajaxObject('/ajaxvideo',evalAjax);
			ajax.update('type=watch&prodid='+prodid+'&fullScreen='+fullScreen,'GET');
		} else {
			if ($('watchbit_'+watchbit).innerHTML=='Stop')
			{
				frontpageHideVideo();
				$('watchbit_'+watchbit).innerHTML='Watch';
			} else {
				if (previouswatchbitprodid!="")
				{
					$('watchbit_'+previouswatchbitprodid).innerHTML='Watch';
					previouswatchbitprodid='';
				}
				$('watchbit_'+watchbit).innerHTML='Stop';
				previouswatchbitprodid=watchbit;

				var ajax = new ajaxObject('/ajaxvideo',evalAjax);
				ajax.update('type=watch&prodid='+prodid+'&fullScreen='+fullScreen,'GET');
			}
		}
	}
}
var clrListen;
var clrListen2;

function listen(prodid,clipid,title,href)
{
	clearInterval(loadVideoIntervalCheck);
	clearTimeout(clrListen);
	if (ALLOWAUDIO==true)
	{
		if (currentlistenprodid!=clipid)
		{
			frontpageHideVideo();
			currentlistenprodid=clipid;
			CONTENTPLAYING="audio";
			
			$('frontpage_audio').style.display='';
			$('frontpage_audio').style.background='url(/csp/ltgl/goodlife/products/550/'+prodid+'_1.jpg)';
			$('frontpage_audio').style.backgroundRepeat='no-repeat';
			$('frontpage_audio').href=href;
			$('listendiv'+prodid).style.backgroundPosition="0px -41px";
			$('firstAdProdDescription').innerHTML=title;
			$('frontpage_video_inner').style.left='0px';
			$('frontpage_video_inner').style.top='-312px';
			$('frontpage_video').style.width='550px';
			$('frontpage_video').style.height='1px';
			/*$('frontpage_video_inner').style.left='0px';
			$('frontpage_video_inner').style.top='0px';
			$('frontpage_video').style.width='550px';
			$('frontpage_video').style.height='340px';*/
			loadVideo(clipid);
		}		
	}
}
function outlisten()
{
	clearInterval(loadVideoIntervalCheck);
	if (ALLOWAUDIO==true)
	{
		clrListen=setTimeout(outlistendo,100);
		outlistendo();
	}
}
function outlistendo ()
{
	clearInterval(loadVideoIntervalCheck);
	if (CONTENTPLAYING=="audio")
	{
		var el = getElementsByClass(document,'eachOfferInfo','div');
		for(i=0;i<el.length;i++)
		{
			$('listendiv'+el[i].id.split("eachOfferInfo")[1]).style.backgroundPosition="0px 0px";	
			el[i].style.display='none';
		}
		frontpageHideVideo();
/*		clearAJAXPopUp();*/
	}
}
		
		
function grabobj(objname) // v1.0
{
	return $(objname);
}

function $(objname)
{
	if (document.getElementById) return document.getElementById(objname);
	if (document.all) return document.all[objname];
	if (document.layers) return document.layers[objname];
}
function menuInitLTGL ()
{
	var i=1;
	while ($('menu_'+i))
	{
		$('menu_'+i).onmouseover=function(){ displayMenuLTGL(this);}
		$('menu_'+i).onmouseout=function(){ hideMenu(this);}
		i++;
	}
	i=1;
	while ($('menu_'+i+'_content'))
	{
		$('menu_'+i+'_content').onmouseover=function(){ clearMenuTimer(); }
		$('menu_'+i+'_content').onmouseout=function(){ menuTimer=window.setTimeout("closeMenus()",300);  }
		i++;
	}


}
function displayMenuLTGL (obj)
{	
	clearTimeout(menuTimer);
	var i=1;
	while ($('menu_'+i+'_content'))
	{
		$('menu_'+i+'_content').style.display='none';
		i++;
	}
	var id=obj.id.split('_')[1];
	$('menu_'+id+'_content').style.display='block';
	$('menu_'+id+'_content').style.top='186px';



	var popupWidth=$('menu_'+id+'_content').offsetWidth;
	var tabWidth=$('menu_'+id).offsetWidth;




	if ((findPos(obj)[0]+popupWidth)>1000)
	{
	 	var newLeft=(findPos(obj)[0]-findPos($('wrapper'))[0])-popupWidth+tabWidth;
		if (newLeft>0)
		{
			$('menu_'+id+'_content').style.left=newLeft+'px';
		} else {
			var bWidth=(findPos($('wrapper'))[0]*2)+1000;
			
			$('menu_'+id+'_content').style.left=((bWidth/2)-(popupWidth/2)-findPos($('wrapper'))[0])+'px';
		}
	} else {
		$('menu_'+id+'_content').style.left=(findPos(obj)[0]-findPos($('wrapper'))[0])+'px';
	}


}

function menuInitYGT ()
{
	var i=1;
	while ($('menu_'+i))
	{
		$('menu_'+i).onmouseover=function(){ displayMenuLTGL(this);}
		$('menu_'+i).onmouseout=function(){ hideMenu(this);}
		i++;
	}
	i=1;
	while ($('menu_'+i+'_content'))
	{
		$('menu_'+i+'_content').onmouseover=function(){ clearMenuTimer(); }
		$('menu_'+i+'_content').onmouseout=function(){ menuTimer=window.setTimeout("closeMenus()",300);  }
		i++;
	}


}
function displayMenuYGT (obj)
{	
	clearTimeout(menuTimer);
	var i=1;
	while ($('menu_'+i+'_content'))
	{
		$('menu_'+i+'_content').style.display='none';
		i++;
	}
	var id=obj.id.split('_')[1];
	$('menu_'+id+'_content').style.display='block';
	$('menu_'+id+'_content').style.top='186px';



	var popupWidth=$('menu_'+id+'_content').offsetWidth;
	var tabWidth=$('menu_'+id).offsetWidth;




	if ((findPos(obj)[0]+popupWidth)>1000)
	{
	 	var newLeft=(findPos(obj)[0]-findPos($('wrapper'))[0])-popupWidth+tabWidth;
		if (newLeft>0)
		{
			$('menu_'+id+'_content').style.left=newLeft+'px';
		} else {
			var bWidth=(findPos($('wrapper'))[0]*2)+1000;
			
			$('menu_'+id+'_content').style.left=((bWidth/2)-(popupWidth/2)-findPos($('wrapper'))[0])+'px';
		}
	} else {
		$('menu_'+id+'_content').style.left=(findPos(obj)[0]-findPos($('wrapper'))[0])+'px';
	}


}





function menuInitFOCUS ()
{
	var i=1;
	while ($('menu_'+i))
	{
		$('menu_'+i).onmouseover=function(){ displayMenuLTGL(this);}
		$('menu_'+i).onmouseout=function(){ hideMenu(this);}
		i++;
	}
	i=1;
	while ($('menu_'+i+'_content'))
	{
		$('menu_'+i+'_content').onmouseover=function(){ clearMenuTimer(); }
		$('menu_'+i+'_content').onmouseout=function(){ menuTimer=window.setTimeout("closeMenus()",300);  }
		i++;
	}


}
function displayMenuFOCUS (obj)
{	
	clearTimeout(menuTimer);
	var i=1;
	while ($('menu_'+i+'_content'))
	{
		$('menu_'+i+'_content').style.display='none';
		i++;
	}
	var id=obj.id.split('_')[1];
	$('menu_'+id+'_content').style.display='block';
	$('menu_'+id+'_content').style.top='186px';



	var popupWidth=$('menu_'+id+'_content').offsetWidth;
	var tabWidth=$('menu_'+id).offsetWidth;




	if ((findPos(obj)[0]+popupWidth)>1000)
	{
	 	var newLeft=(findPos(obj)[0]-findPos($('wrapper'))[0])-popupWidth+tabWidth;
		if (newLeft>0)
		{
			$('menu_'+id+'_content').style.left=newLeft+'px';
		} else {
			var bWidth=(findPos($('wrapper'))[0]*2)+1000;
			
			$('menu_'+id+'_content').style.left=((bWidth/2)-(popupWidth/2)-findPos($('wrapper'))[0])+'px';
		}
	} else {
		$('menu_'+id+'_content').style.left=(findPos(obj)[0]-findPos($('wrapper'))[0])+'px';
	}


}







function menuInitCHUMS ()
{
	var i=1;
	while ($('menu_'+i))
	{
		$('menu_'+i).onmouseover=function(){ displayMenuCHUMS(this);}
		$('menu_'+i).onmouseout=function(){ hideMenu(this);}
		i++;
	}
	i=1;
	while ($('menu_'+i+'_content'))
	{
		$('menu_'+i+'_content').onmouseover=function(){ clearMenuTimer(); }
		$('menu_'+i+'_content').onmouseout=function(){ menuTimer=window.setTimeout("closeMenus()",300);  }
		i++;
	}


}
function displayMenuCHUMS (obj)
{	
	clearTimeout(menuTimer);
	var i=1;
	while ($('menu_'+i+'_content'))
	{
		$('menu_'+i+'_content').style.display='none';
		i++;
	}
	var id=obj.id.split('_')[1];
	$('menu_'+id+'_content').style.display='block';
	$('menu_'+id+'_content').style.top='138px';



	var popupWidth=$('menu_'+id+'_content').offsetWidth;
	var tabWidth=$('menu_'+id).offsetWidth;




	if ((findPos(obj)[0]+popupWidth)>1000)
	{
	 	var newLeft=(findPos(obj)[0]-findPos($('wrapper'))[0])-popupWidth+tabWidth;
		if (newLeft>0)
		{
			$('menu_'+id+'_content').style.left=newLeft+'px';
		} else {
			var bWidth=(findPos($('wrapper'))[0]*2)+1000;
			
			$('menu_'+id+'_content').style.left=((bWidth/2)-(popupWidth/2)-findPos($('wrapper'))[0])+'px';
		}
	} else {
		$('menu_'+id+'_content').style.left=(findPos(obj)[0]-findPos($('wrapper'))[0])+'px';
	}


}















function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
	}
	return [curleft,curtop];
}
var menuTimer;
function hideMenu (id)
{
	menuTimer=window.setTimeout("closeMenus()",300);
}
function closeMenus ()
{
	var i=1;
	while ($('menu_'+i+'_content'))
	{
		$('menu_'+i+'_content').style.display='none';
		i++;
	}

}
function clearMenuTimer ()
{
	clearTimeout(menuTimer);
}


function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
	}
	return [curleft,curtop];
}
function prodImageSwap (opt,obj,label)
{
  if (obj)
  {
	obj=grabobj(obj);
	if (obj)
	{

	 if (opt==1)
	 {
	  obj.src=obj.src.replace('_8','_1');
	  obj.src=obj.src.replace('_7','_1');
	  obj.src=obj.src.replace('_6','_1');
	  obj.src=obj.src.replace('_5','_1');
	  obj.src=obj.src.replace('_4','_1');
	  obj.src=obj.src.replace('_3','_1');
	  obj.src=obj.src.replace('_2','_1');
	 } else {
	  obj.src=obj.src.replace('_8','_'+opt);
	  obj.src=obj.src.replace('_7','_'+opt);
	  obj.src=obj.src.replace('_6','_'+opt);
	  obj.src=obj.src.replace('_5','_'+opt);
	  obj.src=obj.src.replace('_4','_'+opt);
	  obj.src=obj.src.replace('_3','_'+opt);
	  obj.src=obj.src.replace('_2','_'+opt);
	  obj.src=obj.src.replace('_1','_'+opt);
	 }
	}
	$('mainprodimg_label').innerHTML=label+"&nbsp;";

  }
}
var blockajax=false;
function basketAdd(stno,qty)
{
	if (blockajax==true)
	{
		window.location='/csp/ltgl/goodlife/ajaxbag.csp?stno='+stno+'&qty='+qty+'&direct=1';
	} else {
		var ajax = new ajaxObject('/csp/ltgl/goodlife/ajaxbag.csp',BasketMessage);
		ajax.update('stno='+stno+'&qty='+qty,'GET');
	}
}
function BasketMessage(returnedHTML)
{
	$('basket_frame').src=$('basket_frame').src;
	$('PopUpBox').innerHTML=returnedHTML;
	$('PopUpBox').style.display='block';
	$('PopUpBox').style.position='absolute';
//	Didn't support webkit browsers
//	$('PopUpBox').style.top=parseFloat(document.documentElement.scrollTop)+50+'px';
	ScrollTop=0;
	if(window.pageYOffset) {
		ScrollTop = window.pageYOffset;
	} else {
		ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
	}
	$('PopUpBox').style.top=ScrollTop+50+'px';
	$('PopUpBox').style.left='50%';
	$('PopUpBox').style.marginLeft='-'+$('PopUpBox').offsetWidth/2+'px';
	boxesOpen=1;
}
function popupDiv(ref)
{
	var ajax = new ajaxObject('/csp/ltgl/goodlife/AJAXPopUps.csp?page='+ref+'&',UpdatePopUp);
	ajax.update('','GET');
}
function UpdatePopUp(returnedHTML)
{
	$('PopUpBox').innerHTML=returnedHTML;
	$('PopUpBox').style.display='block';
	$('PopUpBox').style.position='absolute';
	$('PopUpBox').style.top=parseFloat(document.documentElement.scrollTop)+50+'px';
	$('PopUpBox').style.left='50%';
	$('PopUpBox').style.marginLeft='-'+$('PopUpBox').offsetWidth/2+'px';
	boxesOpen=1;
	displayFullScreen();
}
function clearAJAXPopUp()
{
	$('PopUpBox').style.display='none';
	$('PopUpBox').innerHTML='';
	hideFullScreen();
	boxesOpen=0;
}
var gl=0;
var gt=0;
function popupDivLtgl(ref,l,t)
{
	gl=l;
	gt=t;
	var ajax = new ajaxObject('/csp/ltgl/goodlife/AJAXPopUps.csp?page='+ref+'&',UpdatePopUpLtgl);
	ajax.update('','GET');
}
function UpdatePopUpLtgl(returnedHTML,l,t)
{
	$('PopUpBox').innerHTML=returnedHTML;
	$('PopUpBox').style.display='block';
	$('PopUpBox').style.position='absolute';
	$('PopUpBox').style.top=gt+'px';
	$('PopUpBox').style.left=gl+'px';
	boxesOpen=1;
}
function clearAJAXPopUp()
{
	$('PopUpBox').style.display='none';
	$('PopUpBox').innerHTML='';
	hideFullScreen();
	boxesOpen=0;
	if ($('frontpage_video')) frontpageHideVideo();
}



function viewLarge(ref,opt)
{
	html="<div style=\"width:606px;\">";
	html+="<iframe src=\"/csp/sweet/delight/view.csp?id="+ref+"\" style=\"width:604px;height:404px;border:0px;\" scrolling=\"no\" frameborder=\"0\"></iframe>";

	html+="<div align=\"center\"><input type=\"button\" style=\"font-weight:bold;font-size:13px;\" onclick=\"clearItem('bigimg');\" value=\"Close Viewport\"></div>";
	html+="</div>";
	displayBox('bigimg',html);
}

function viewPackaging(ref)
{
	html="<div style=\"width:800px;\">";
	html+="<iframe src=\"/csp/sweet/delight/packaging.csp?id="+ref+"\" style=\"width:800px;height:300px;border:0px;\" scrolling=\"no\" frameborder=\"0\"></iframe>";

	html+="<div align=\"center\"><input type=\"button\" style=\"font-weight:bold;font-size:13px;margin-top:10px;\" onclick=\"clearItem('bigimg');\" value=\"Close Viewport\"></div>";
	html+="</div>";
	displayBox('bigimg',html);
}

function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function retrieveCmd (cmd)
{
 var ajax = new ajaxObject('/csp/ltgl/goodlife/ajaxCmd.csp',evalAjax);
 ajax.update(cmd,'GET');
 
}
function evalAjax (t,s)
{	
	eval(t);
}

function ajaxObject(url, callbackFunction) {


  var that=this;      
  this.updating = false;
  this.abort = function() {
    if (that.updating) {
      that.updating=false;
      that.AJAX.abort();
      that.AJAX=null;
    }
  }
  this.update = function(passData,postMethod) { 
    if (that.updating) { return false; }
    that.AJAX = null;                          
    if (window.XMLHttpRequest) {              
      that.AJAX=new XMLHttpRequest();              
    } else {                                  
      that.AJAX=new ActiveXObject("Microsoft.XMLHTTP");
    }                                             
    if (that.AJAX==null) {                             
      return false;                               
    } else {
      that.AJAX.onreadystatechange = function() {  
        if (that.AJAX.readyState==4) {             
          that.updating=false;
          that.callback(that.AJAX.responseText,that.AJAX.status,that.AJAX.responseXML);        
          that.AJAX=null;                                         
        }                                                      
      }                                                        
      that.updating = new Date();        
	  
	  if ($('ajaxcall')) $('ajaxcall').innerHTML=new Date();
      if (/post/i.test(postMethod)) {
        var uri=urlCall+'?'+that.updating.getTime();
        that.AJAX.open("POST", uri, true);
        that.AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        that.AJAX.send(passData);
      } else {
        var uri=urlCall+'?'+passData+'&stamp='+(that.updating.getTime()); 
        that.AJAX.open("GET", uri, true);                             
        that.AJAX.send(null);                                         
      }              
      return true;                                             
    }
  }
  var urlCall = url;
  this.callback = callbackFunction || function () { };
}
function watchVideo()
{
	if ($('videoplayerbut'))
	{
		$('mainimage').style.display='none';
		$('video').style.display='inline';
		$('videoplayerbut').style.display='none';
	}
}
function closeVideo()
{
	$('mainimage').style.display='';
	$('video').style.display='none';
	$('videoplayerbut').style.display='';
	$('video').innerHTML+='<SCRIPT LANGUAGE=JavaScript TYPE="text/javascript" SRC="http://www.webvideocore.net/js/embedplayer.js" ><\/SCRIPT>';
}


var usepage;
function insertPage(obj,page)
{
	usepage=obj;
	var ajax = new ajaxObject(page,insertPageCode);
	ajax.update('','GET');
}
function insertPageCode(t,s)
{
	usepage.innerHTML=t;
}


function getElementsByClass(node,searchClass,tag) {
  var classElements = new Array();
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)" + searchClass + "(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if ( pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
return classElements;
}
function imgovervideo(pno)
{
$('frontpage_imgovervideo').innerHTML='<img src="/csp/ltgl/goodlife/products/550/'+pno+'_1.jpg">';
$('frontpage_imgovervideo').style.display='';
}
function imgoutvideo()
{
$('frontpage_imgovervideo').style.display='none';
}

function getSWF(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		if (window[movieName]) return window[movieName];
	}
	else {
		if (document[movieName]) return document[movieName];
	}
	return false;
}
function projectVid(vidCode)
{
	alert(vidCode);
	/*
	var m = new SWFObject("http://www.streamingvideoprovider.com/player0.swf", "eplayer", "550", "330", "8", "", true);
	m.addParam("quality", "high");
	m.addParam("wmode", "transparent");
	m.addVariable("no_fs", "1");
	m.addVariable("autoStart", "0");
	m.addVariable("clip_id", vidCode);
	m.addVariable("color1", "#a6a6a6");
	m.addVariable("color", "#a6a6a6");
	m.addVariable("autoHide", "0");
	m.addVariable("rid", Math.random().toString().split(".")[1]);
	m.addVariable("brandNW", "1");
	m.addVariable("color_ratio", "0.6");
	m.addVariable("page", "http%3A%2F%2Fltgl.mtechpreview.com%2F");
	m.addParam("swLiveConnect", "true");
	m.addParam("LOOP", "false");
	m.addParam("allowScriptAccess", "always");
	m.addParam("allowFullScreen", "true");
	m.addVariable("native_fs", "1");
	m.write("frontpage_video");*/
}

var openpromo=false;
function enterPromo (m)
{
	clearItem('promo');
	//var ajax = new ajaxObj3('/ajaxdrop/?Media='+m,evalAjax);
	//ajax.update('','POST');
	var url='/ajaxdrop/?Media='+m;
	window.location=url+'&direct=1';
	return false;
}
function evalAjax(t) {
	eval(unescape(t));
}