var doc;
var sty;
var ie = document.all ? 1 : 0
var ns = document.layers ? 1 : 0
var initialize = 0
var Ex, Ey, topColor, subColor, ContentInfo
if(ie){
Ex = "event.x"
Ey = "event.y"
topColor = "#FF9428"
subColor = "#990000"
}
if(ns){
Ex = "e.pageX"
Ey = "e.pageY"
window.captureEvents(Event.MOUSEMOVE)
window.onmousemove=overhere
topColor = "#FF9428"
subColor = "#990000"
}
function MoveToolTip(layerName, FromTop, FromLeft, e){
if(ns){doc = "document."; sty = ""}
if(ie){doc = "document.all."; sty = ".style"}
if(ie){eval(doc + layerName + sty + ".top = "  + (eval(FromTop) + document.body.scrollTop))}
if(ns){eval(doc + layerName + sty + ".top = "  +  eval(FromTop))}
eval(doc + layerName + sty + ".left = " + (eval(FromLeft) + 15))
}
function ReplaceContent(layerName){
if(ie){document.all[layerName].innerHTML = ContentInfo}
if(ns){
with(document.layers[layerName].document) 
{ 
   open(); 
   write(ContentInfo); 
   close(); 
}
}
}
function Activate(){initialize=1}
function deActivate(){initialize=0}
function overhere(e){
if(initialize){
MoveToolTip("ToolTip", Ey, Ex, e)
eval(doc + "ToolTip" + sty + ".visibility = 'visible'")
}
else{
MoveToolTip("ToolTip", 0, 0)
eval(doc + "ToolTip" + sty + ".visibility = 'hidden'")
}
}
function EnterContent(layerName, TTitle, TContent){
ContentInfo = '<table border="0" width="150" cellspacing="0" cellpadding="0">'+
'<tr><td width="100%" bgcolor="#000000">'+
'<table border="0" width="100%" cellspacing="1" cellpadding="0">'+
'<tr><td width="100%" bgcolor='+topColor+'>'+
'<table border="0" width="90%" cellspacing="0" cellpadding="0" align="center">'+
'<tr><td width="100%" align="center">'+
'<font class="tooltiptitle">&nbsp;'+TTitle+'</font>'+
'</td></tr>'+
'</table>'+
'</td></tr>'+
'<tr><td width="100%" bgcolor='+subColor+'>'+
'<table border="0" width="90%" cellpadding="0" cellspacing="1" align="center">'+
'<tr><td width="100%">'+
'<font class="tooltipcontent" align="left">'+TContent+'</font>'+
'</td></tr>'+
'</table>'+
'</td></tr>'+
'</table>'+
'</td></tr>'+
'</table>';
ReplaceContent(layerName)
}

function validateEmail( txtEmail ) {
	email=txtEmail.value;
	flag=true;
	akeong=email.indexOf('@')
	titik =email.indexOf('.')
	if(akeong==-1 || akeong==0 || akeong==email.length-1)
		flag=false;
	if(titik==-1 || titik==0 || titik==email.length-1)
		flag=false;
	if(akeong>titik)
		flag=false;
	if(akeong==titik-1 || akeong==titik+1)
		flag=false;	
	if(flag==false) {
		txtEmail.select();
		txtEmail.focus();
		return 1;
	}
	return 0;
}

function validateSubscribe() {
	if(document.frmSubscribe.txtName.value=='') {
		alert('Please fill name field');
		document.frmSubscribe.txtName.select();
		document.frmSubscribe.txtName.focus();
	}
	else if(document.frmSubscribe.txtAddress.value=='') {
		alert('Please fill address field');
		document.frmSubscribe.txtAddress.select();
		document.frmSubscribe.txtAddress.focus();
	}
	else if(document.frmSubscribe.txtCompany.value=='') {
		alert('Please fill Company field');
		document.frmSubscribe.txtCompany.select();		
		document.frmSubscribe.txtCompany.focus();
	}
	else if(document.frmSubscribe.txtJobTitle.value=='') {
		alert('Please fill Job Title field');
		document.frmSubscribe.txtJobTitle.select();		
		document.frmSubscribe.txtJobTitle.focus();
	}
	else if (document.frmSubscribe.txtEmail.value=='') {
		alert('Please fill email field');
		document.frmSubscribe.txtEmail.select();		
		document.frmSubscribe.txtEmail.focus();
	}
	else if ( validateEmail( document.frmSubscribe.txtEmail ) ) {
		alert("Please Fill Your Email Correctly!\netc : \"username@domain.com\"");
		document.frmSubscribe.txtEmail.focus();	
	}
	else {
		if ( document.frmSubscribe.chkProfile.checked == true ) {
			myDummy = window.open( "download/OIA_Retreat_Profilev2.doc" );
		}
		if ( document.frmSubscribe.chkNewsletter.checked == true ) {
			myDummy2 = window.open( "download/newsletter.doc" );
		}
		document.frmSubscribe.submit();
	}
}
function mypopup(title,thelink,features) {
	mywindow = window.open (thelink,title,features);
  mywindow.moveTo(0,0);
}

function changePagePortal() {
	for( i=0; i<formHeader.cmbPortal.length; i++ ) {
		if( formHeader.cmbPortal[i].selected) {
			//document.URL = formHeader.cmbPortal[i].value;
			location.href=formHeader.cmbPortal[i].value;
			//window.location=formHeader.cmbPortal[i].value;
			/*
			mywindow = window.open (formHeader.cmbPortal[i].value,"OIARetreats","width=300,height=300");
	  		mywindow.moveTo(0,0); 
			*/
		}
	}
}

function changePageLinks() {
	for( i=0; i<formHeader.cmbLinks.length; i++ ) {
		if( formHeader.cmbLinks[i].selected ) {
			window.location=formHeader.cmbLinks[i].value;
		}		
	}
}