//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@ JavaScript codes for 
//@ 
//@ created 23 September 2004
//@ 
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@	

// Dummy comment to hide code from non-JavaScript browsers.


//***************************
//* page changing code
//* for both frames
//***************************
function WEBPAGE(PAGE1,PAGE2)
	{
	window.parent.upperFrame.location = PAGE1
	window.parent.lowerFrame.location = PAGE2
	}

function ShowImage(img,title)
{
  foto1= new Image();
  foto1.src=(img);
  CalImage(img,title);
}
function CalImage(img,title)
{
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img,title);
  }
  else{
    funzione="CalImage('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewFoto(img,title)
{
// need to work on centing Image popup
// also add some more text
  largh=foto1.width+20;
  altez=foto1.height+55;
 var ScreenWidth = (window.screen.availWidth / 2);
 var ScreenHeight = (window.screen.availHeight / 2);
 var WW = ScreenWidth - (largh / 2) ;
 var TT = ScreenHeight - (altez / 2) ;
 // "top=" + TT + ","left=" + WW + ,
 // stringa="top=10 left=10,width="+largh+",height="+altez;
  stringa = "top = " + TT + " , left = " + WW + " , width = " + largh + " , height = " + altez + " ,resizable=yes,scrollbars=yes,status=no";
  // alert(stringa); 
  // finestra=window.open(img,"",stringa);
  
var charPop_wnd

charPop_wnd = window.open('','charPop_wnd',stringa);
charPop_wnd.document.writeln('<html>');
charPop_wnd.document.writeln('<Head>');
charPop_wnd.document.writeln('<TITLE>');
charPop_wnd.document.writeln(title);
charPop_wnd.document.writeln('</TITLE>');
charPop_wnd.document.writeln('<LINK REL="stylesheet" TYPE="text/css" HREF="parent.css">');
charPop_wnd.document.writeln('</Head>');
charPop_wnd.document.writeln("<body marginheight=0 marginwidth=0 leftmargin=0 rightmargin=0>");
charPop_wnd.document.writeln("<center>")
charPop_wnd.document.writeln("<p><a href=Javascript:onclick=window.close('')>")
charPop_wnd.document.writeln('<p><img src="' + img + '" border="0" title="Click to Close" >');
charPop_wnd.document.writeln('</a>');
charPop_wnd.document.writeln('</div>')
charPop_wnd.document.writeln('<br><Font class="SmallPrint"> POP CREATED BY<BR><a href="http://www.myle.co.nz" target="_Blank">MYLE</A></font>')
charPop_wnd.document.writeln('</center>')
charPop_wnd.document.writeln('</body>')
charPop_wnd.document.writeln('</html>')
charPop_wnd.document.close();

}


// function SetCookie(name,value)
// {
// var never = new date()
// var never.seTime(never.getTime() + 2000*24*60*60*100);
// var expString = "; expires=" + never.toGMTString();
// document.cookie = name + "=" escape(value) + expString;
// }



function GetCookie(name)
//************************************************
// Read a Cookie 
// Written by William
//************************************************
	{
	var result = null;
	var myCookie =  " " + document.cookie + ";";
	var searchName = " " + name + "=";
	var startOfCookie = myCookie.indexOf(searchName);
	var endOfCookie
	if (startOfCookie != -1) {
	startOfCookie += searchName.length;
	endOfCookie = myCookie.indexOf(";", startOfCookie);
	result = unescape(myCookie.substring(startOfCookie, endOfCookie));
	}	
	return result;
	}



function PopupIt(url,width,Height)
//************************************************
// OPEN A POP WINDOW 
//************************************************
	{
	//alert(window.screen.availWidth);
	var popupWidth = (window.screen.availWidth / 2) + width;
	var popupHeight = (window.screen.availHeight / 2) + Height;
	var popupTop = (popupHeight / 2) - (Height);
	var popupLeft = (popupWidth / 2) - (width);
	//alert(popupWidth);
	//alert("top=" + popupTop + " , left=" + popupLeft + " , width=" + popupWidth + " , height=" + popupHeight + " location=No,scrollbars=yes,status=no");
	popupwin = window.open(url, "new_page","top=" + popupTop + " , left=" + popupLeft + " , width=" + popupWidth + " , height=" + popupHeight + " location=No,scrollbars=yes,status=no");
	popupwin.focus();
	}


function PopupIt2(url,width,Height)
//************************************************
// OPEN A POP WINDOW 
//************************************************
	{
	// alert('h=' + window.screen.availHeight);
	var popupWidth = (window.screen.availWidth / 2) - (width / 2);
	var popupHeight = (window.screen.availHeight / 2) - (Height / 2);
	var popupTop = popupHeight     
	var popupLeft = popupWidth 
	// THANKS ROBIN FOR THE HELP FOR THIS    
	// alert('popupHeight = ' + popupHeight);
	// alert("top=" + popupTop + " , left=" + popupLeft + " , width=" + width + " , height=" + Height + " location=No,scrollbars=yes,status=no,menubar=no");
	popupwin = window.open(url, "new_page","top=" + popupTop + " , left=" + popupLeft + " , width=" + width + " , height=" + Height + " location=No,scrollbars=yes,status=no");
	popupwin.focus();
	}


function PopupIt3(url,width,Height)
//************************************************
// OPEN A POP WINDOW 
//************************************************
	{
	//alert(window.screen.availWidth);
	var popupWidth = (window.screen.availWidth / 2) + width;
	var popupHeight = (window.screen.availHeight / 2) + Height;
	var popupTop = (popupHeight / 2) - (Height);
	var popupLeft = (popupWidth / 2) - (width);
	//alert(popupWidth);
	//alert("top=" + popupTop + " , left=" + popupLeft + " , width=" + popupWidth + " , height=" + popupHeight + " location=No,scrollbars=yes,status=no");
	popupwin = window.open(url, "new_page","top=" + popupTop + " , left=" + popupLeft + " , width=" + popupWidth + " , height=" + popupHeight + " location=no,scrollbars=yes,status=no,menubar=yes");
	popupwin.focus();
	}

function PopupIt4(url,width,Height)
//************************************************
// OPEN A POP WINDOW 
//************************************************
	{
	//alert(window.screen.availWidth);
	var popupWidth = (window.screen.availWidth / 2) + width;
	var popupHeight = (window.screen.availHeight / 2) + Height;
	var popupTop = (popupHeight / 2) - (Height);
	var popupLeft = (popupWidth / 2) - (width);
	//alert(popupWidth);
	//alert("top=" + popupTop + " , left=" + popupLeft + " , width=" + popupWidth + " , height=" + popupHeight + " location=No,scrollbars=yes,status=no");
	popupwin = window.open(url, "MYLE_pages","top=" + popupTop + " , left=" + popupLeft + " , width=" + popupWidth + " , height=" + popupHeight + " location=no,scrollbars=yes,status=no,menubar=yes");
	popupwin.focus();
	}





function goPage(src) 
{
if(self.opener)
    {
   //self.opener.focus();   
   self.opener.location.href = src;
   //self.close();
   }
}


function ExpandSection(idVariable){

// This will hide show a HTML TAG call something

if (document.all[idVariable].style.display=="none")
	{
	document.all[idVariable].style.display="" ;
	}
else	{
	document.all[idVariable].style.display="none" ;
     	}
}


