/*
	LondonTown.com Javascriot routines
*/


/*
	Restore an image that has been swapped - MM
*/
function MM_swapImgRestore() {
	var i,x,a=document.MM_sr;
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

/*
	Preload rollovers into memory for fast swapping MM
*/
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

/*
	Locate an object in multiple browsers
*/
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

/*
	Swap one image with another
*/
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/*
	evaluate a JS piece of code.
*/
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

/*
	Image swapping, used in the main menu of template
*/
function imgswap(iname){
	MM_swapImage(iname,'','images/arrow.highlight.gif',1);
	return 1;
}

/*
	Change the color of a td cell
*/
function col_change( t,ina ){
	t.bgColor='#18558A';
	imgswap(ina);
}

/*
	Restore the image
*/
function restore(){
MM_swapImgRestore();
return 1;
}

/*
	Change the td cell color back to original color
*/
function col_back( t ){
t.bgColor='#437CB0';
restore();
}

/*
	Open a new window with the options
*/
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/*
	Change the display string at the bottom of the page
*/
function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

/*
	Legacy - Used to remove a span created if IE was present and page was loading
*/
function quitspan(){
	var isIE = (navigator.appName.indexOf("Microsoft Internet Explorer")!=-1);
	if (document.all && isIE){
		document.all.loadcoat.style.display="none";
	}
}



/*
	A contact routine, not implemented (yet)
*/
function goContact(thename){
	window.open('/LTtemplates/globalcontact/contactsheet.php?'+thename,'ContactWindow',"height=550,width=636,scrollbars=no,resizable=no");
}

/*
	Load a span with a "loading page sign" - this is not used anymore
*/
function loadit(){
var loader;
var isIE = (navigator.appName.indexOf("Microsoft Internet Explorer")!=-1);
if (isIE){
	loader = '<span id="loadcoat" style="position:absolute; width:594px; top=106px; height:100%; background-color:#000000;  z-index:-5;"><BR><BR><BR><div align=center><img src=images/loading.gif border=0 align=center></div></span>';
	document.write(''+loader+'');
}
}

/*
	As above, different background color
*/
function loaditms(){
var loader;
var isIE = (navigator.appName.indexOf("Microsoft Internet Explorer")!=-1);
if (isIE){
        loader = '<span id="loadcoat" style="width:0px; top=10px; background-color:#ffffff;  z-index:-5;"><BR><div align=center><center><img src="/grafix/clear.gif" width=125 height=2 align=left><img src=images/loading_black.gif border=0 align=center></center></div></span>';
        document.write(''+loader+'');
}
}


/*
	Search London by Keyword.  Function for top left search box in all templates
*/
function runMySearch(){
	if (document.londonsearch.munch.value==''){
		alert("Please enter some keywords to search for.");
	} else {
		document.londonsearch.submit();
	}
}

/*
	Londonpass stuff
*/
function lpbuy() {
tele = window.open("http://www.londonpassoffer.co.uk/scripts/startsp.asp?referrer=LondonTown", "Specifics", "height=460,width=600,scrollbars=yes");}

function popatt(num1,num2) { tele = window.open("/cgi-bin/londonpass/attraction.pl?Attraction_Id="+num1+"&Category_Id="+num2, "Specifics", "height=460,width=600,scrollbars=yes");}
function popconditions() { tele = window.open("../../londonpass/conditions.htm", "", "height=550,width=520,scrollbars=yes,resizable=yes");}
function popfaq() { tele = window.open("/faq/", "", "height=550,width=550,scrollbars=yes,resizable=yes");}

function openWindow(theURL,winName,features) {
	self.name = "main";
	window.open(theURL,winName,features);
}



function rademailpop() {
//  openWindow('http://www.londontown.com/multisearch_info/secure.phtml?lang=English', 'secure', 'scrollbars=yes,width=530,height=450');
  openWindow('http://www.ibm.com/', 'secure', 'scrollbars=yes,width=530,height=450');
}


function WM_imageSwap(daImage, daSrc)
{
	var objStr,obj;
	if(document.images)
	{
		if (typeof(daImage) == 'string') 
		{
			objStr = 'document.' + daImage;obj = eval(objStr);obj.src = daSrc;
		}
		else if ((typeof(daImage) == 'object') && daImage && daImage.src)
		{
			daImage.src = daSrc;
		}
	}
}

