var n = 0;


function handleError() {
	return true;
}

window.onerror = handleError;

    function mailto(user,subject) 
    { 
        document.location.href = "mailto:" + user + "@aupair-agency.com?subject=" + subject; 
    }


if(document.referrer!="" && document.referrer.indexOf("aupair-agency.com")==-1 && document.referrer.indexOf("aupair.ws")==-1){
var expDays = 90;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
var refdate = new Date();
document.cookie = "referrer=" + escape(document.referrer + "&&&" + refdate.toGMTString()) + "; expires=" + exp.toGMTString() + "; path=/" 
}


function noenter() {
return !(window.event && window.event.keyCode == 13); }



var menuname =""; var ThisObject=""

function menuChangeOver(menuname){
ThisObject=document.getElementById(menuname)
ThisObject.style.borderColor='#ff3300';
ThisObject.style.borderWidth='2px';
ThisObject.style.color='#ffffcc';
ThisObject.style.backgroundColor='#006699';
ThisObject.style.paddingTop='9px';
}

function menuChangeOut(menuname){
if (menuname=='menu6' || menuname=='menu7'){
ThisObject=document.getElementById(menuname)
ThisObject.style.borderWidth='1px';
ThisObject.style.borderTopColor='#cccc99';
ThisObject.style.borderTopWidth='3px';
ThisObject.style.borderBottomColor='#cccc99';
ThisObject.style.borderRightColor='#cccc99';
ThisObject.style.borderLeftColor='#cccc99';
ThisObject.style.color='#006699';
ThisObject.style.backgroundColor='#ffffcc';
ThisObject.style.paddingTop='10px';
}
else {
ThisObject=document.getElementById(menuname)
ThisObject.style.borderWidth='1px';
ThisObject.style.borderTopColor='#cccc99';
ThisObject.style.borderTopWidth='3px';
ThisObject.style.borderBottomColor='#cccc99';
ThisObject.style.borderRightColor='#cccc99';
ThisObject.style.borderLeftColor='#ffffcc';
ThisObject.style.color='#006699';
ThisObject.style.backgroundColor='#ffffcc';
ThisObject.style.paddingTop='10px';
}
}


function CloseHelpMenu(tip){
document.getElementById(tip).style.visibility="hidden";
	
}

var topposition=0
var leftposition=0
var x,y
var xdistance, ydistance
var xD,yD
var message


function Tip(tip){
	leftposition=x+xdistance ; topposition=y+ydistance; 
	setTimeout ("CloseHelpMenu('"+tip+"')", 10000);
	
	
	if (document.all) {	
		document.getElementById(tip).style.posLeft=leftposition
		document.getElementById(tip).style.posTop=topposition
		document.getElementById(tip).style.display="block"
     	}

	if (document.getElementById&&!document.all){
		document.getElementById(tip).style.left=leftposition
		document.getElementById(tip).style.top=topposition
		document.getElementById(tip).style.display="block"
     }
}


function handlerMM(e){

	if (document.getElementById&&!document.all) {
	
	x = e.pageX
	y = e.pageY
	xD = e.screenX
	xY = e.screenY
	}
	else {
	
	x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
	y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
	xD = (document.layers) ? e.screenX : event.screenX
	yD = (document.layers) ? e.screenY : event.screenY
	}
	
		
	if ( xD <= window.screen.availWidth/2) { xdistance = 20;}
	else { xdistance = -240;}
    if ( yD <= window.screen.availHeight/2) { ydistance = 10;}
    else { ydistance = -100;}	
	
}

if (document.layers || (document.getElementById&&!document.all)){
	document.captureEvents(Event.MOUSEMOVE);
	}
document.onmousemove = handlerMM;

function menu(MenuNo){
document.getElementById(MenuNo).style.visibility="visible"
}

function menuOut(element,e){
if (!e) var e = window.event
if (document.all&&!element.contains(e.toElement))
element.style.visibility='hidden';
else if (e.relatedTarget&&!contains(element, e.relatedTarget))
element.style.visibility='hidden'
}

function contains (parent, child) {
while (child.parentNode)
if ((child=child.parentNode)==parent)
return true;
return false;
}


function showlist(){
var aupairlist
var windowdetails = "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,titlebar=no,location=no,status=no,width="+eval(screen.width-20)+",height="+eval(screen.height-100)+",top=0,left=0,";
aupairlist=document.location.href= 'Aupair-List.htm'
aupairlist.focus();
}
function ukshowlist(){
var aupairlist
var windowdetails = "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,titlebar=no,location=no,status=no,width="+eval(screen.width-20)+",height="+eval(screen.height-100)+",top=0,left=0,";
aupairlist=document.location.href= 'UK-Aupair-List.htm'
aupairlist.focus();
}
function usshowlist(){
var aupairlist
var windowdetails = "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,titlebar=no,location=no,status=no,width="+eval(screen.width-20)+",height="+eval(screen.height-100)+",top=0,left=0,";
aupairlist=document.location.href= 'USA-Aupair-List.htm'
aupairlist.focus();
}
function usshowSlist(){
var aupairlist
var windowdetails = "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,titlebar=no,location=no,status=no,width="+eval(screen.width-20)+",height="+eval(screen.height-100)+",top=0,left=0,";
aupairlist=document.location.href= 'USA-Summer-Aupair-List.htm'
aupairlist.focus();
}
function ukshowSlist(){
var aupairlist
var windowdetails = "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,titlebar=no,location=no,status=no,width="+eval(screen.width-20)+",height="+eval(screen.height-100)+",top=0,left=0,";
aupairlist=document.location.href= 'UK-Summer-Aupair-List.htm'
aupairlist.focus();
}
function showSlist(){
var aupairlist
var windowdetails = "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,titlebar=no,location=no,status=no,width="+eval(screen.width-20)+",height="+eval(screen.height-100)+",top=0,left=0,";
aupairlist=document.location.href= 'Summer-Aupair-List.htm'
aupairlist.focus();
}
function nannyshowlist(){
var nannylist
var windowdetails = "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,titlebar=no,location=no,status=no,width="+eval(screen.width-20)+",height="+eval(screen.height-100)+",top=0,left=0,";
nannylist=document.location.href= 'Nanny-List.htm'
nannylist.focus();
}





function showjoblist(){
var aupairlist
var windowdetails = "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,titlebar=no,location=no,status=no,width="+eval(screen.width-20)+",height="+eval(screen.height-100)+",top=0,left=0,";
aupairlist=document.location.href= 'Aupair-Jobs.htm'
aupairlist.focus();
}
function ukshowjoblist(){
var aupairlist
var windowdetails = "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,titlebar=no,location=no,status=no,width="+eval(screen.width-20)+",height="+eval(screen.height-100)+",top=0,left=0,";
aupairlist=document.location.href= 'Aupair-Jobs-UK.htm'
aupairlist.focus();
}
function usshowjoblist(){
var aupairlist
var windowdetails = "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,titlebar=no,location=no,status=no,width="+eval(screen.width-20)+",height="+eval(screen.height-100)+",top=0,left=0,";
aupairlist=document.location.href= 'Aupair-Jobs-USA.htm'
aupairlist.focus();
}


var allCookies = document.cookie;
var cPos = allCookies.indexOf("referrer=");
if(cPos != -1){
var cdstart = cPos + 9;
var cdend = allCookies.indexOf(";", cdstart);
if(cdend == -1) cdend = allCookies.length;
var cookieContent = allCookies.substring(cdstart,cdend);
cookieContent = unescape(cookieContent);
var cdatestart = cookieContent.indexOf("&&&", 0);
var cdateend = cookieContent.length;
var cRefer = cookieContent.substring(0,cdatestart);
var cDateRef = cookieContent.substring(cdatestart +2,cdateend)
}
else{
var cRefer = "NoReferrer";
var cDateRef = "No cookie";
}



function ValidateEmail(){
				window.document.Form1.IPAddress.value='http://api.hostip.info/get_html.php?ip='+ip;
				window.document.Form1.ReferredFrom.value=cRefer;
				if (window.document.Form1.Comments.value==''){
				window.alert("If you are serious about finding a job please enter as much as possible!");
				window.document.Form1.Comments.focus();
				document.getElementById('tip6').style.left=0;
				return false;
				}

				if (window.document.Form1.Email.value!= window.document.Form1.EmailConfirm.value){
				window.alert("The email address' you entered are not the same!");
				window.document.Form1.EmailConfirm.focus();
				window.scrollBy(0,-100);
				window.document.Form1.EmailConfirm.style.backgroundColor='red';
				return false;
				}
				
				if (window.document.Form1.From.value==''){
				window.alert("We need to know when you are available?");
				window.document.Form1.From.focus();
				window.document.Form1.From.style.backgroundColor='red';
				return false;
				}
				
				if (window.document.Form1.Term.value==''){
				window.alert("We need to know how long you want to be an aupair for?");
				window.document.Form1.Term.focus();
				window.document.Form1.Term.style.backgroundColor='red';
				return false;
				}
				if (window.document.Form1.Age.value==''){
				window.alert("For visa purposes, we need to know how old you are?");
				window.document.Form1.Age.focus();
				window.document.Form1.Age.style.backgroundColor='red';
				return false;
				}
				if (window.document.Form1.Term.value=='24 months'){
				definite=confirm('You have chosen 24 months as the period of time you want to be an aupair for? If not press cancel and correct your entry.');
					if ( !definite ){window.document.Form1.Term.style.backgroundColor='red';return false;}
				}
				
				if (window.document.Form1.Countries.value=='Any Country'){
				definite=confirm('Please click OK to confirm that you are happy to be an aupair in ANY COUNTRY? If not press cancel and correct your entry.');
					if ( !definite ){window.document.Form1.Countries.style.backgroundColor='red';return false;}
				}
				
				if (window.document.getElementById('Elderly').style.visibility=='hidden'){
				window.document.Form1.Elderly[0].value='No';								   
				}
				
				for(i=0; i<document.Form1.elements.length; i++){
				var x= document.Form1.elements[i].value;
				if (x.indexOf('http')!=-1 && document.Form1.elements[i].name!='ReferredFrom' && document.Form1.elements[i].name!='redirect' && document.Form1.elements[i].name!='IPAddress'){
				alert('To stop SPAM HTML is not allowed on the form');
				return false;
					}
				}
												   
window.document.Form1.submit();		
}

function ValidateNannyEmail(){
				window.document.Form1.IPAddress.value='http://api.hostip.info/get_html.php?ip='+ip;
				window.document.Form1.ReferredFrom.value=cRefer;
				if (window.document.Form1.Comments.value==''){
				window.alert("If you are serious about finding a job please enter as much as possible!");
				window.document.Form1.Comments.focus();
				document.getElementById('tip6').style.left=0;
				return false;
				}

				if (window.document.Form1.Email.value!= window.document.Form1.EmailConfirm.value){
				window.alert("The email address' you entered are not the same!");
				window.document.Form1.EmailConfirm.focus();
				window.scrollBy(0,-100);
				window.document.Form1.EmailConfirm.style.backgroundColor='red';
				return false;
				}
														
				
				for(i=0; i<document.Form1.elements.length; i++){
				var x= document.Form1.elements[i].value;
				if (x.indexOf('http')!=-1 && document.Form1.elements[i].name!='ReferredFrom' && document.Form1.elements[i].name!='redirect' && document.Form1.elements[i].name!='IPAddress'){
				alert('To stop SPAM HTML is not allowed on the form');
				return false;
					}
				}
												   
window.document.Form1.submit();		
}

function SiteMap(WhichPage){
var WhichHref
if (WhichPage=='AupairPage'){WhichHref = 'aupair-page.htm'}
if (WhichPage=='AupairLists'){WhichHref = 'Aupair-Lists.htm'}
if (WhichPage=='AupairJobs'){WhichHref = 'job-vacancies.htm'}
if (WhichPage=='NannyPage'){WhichHref = 'nanny-page.htm'}
if (WhichPage=='FamilyPage'){WhichHref = 'Aupair-Wanted.htm'}
if (WhichPage=='UKFamily'){WhichHref = 'Aupair-Wanted-UK.htm'}
if (WhichPage=='USAFamily'){WhichHref = 'Aupair-Wanted-USA.htm'}
if (WhichPage=='Terms'){WhichHref = 'terms-conditions.htm'}
if (WhichPage=='UKTerms'){WhichHref = 'UK-terms.htm'}
if (WhichPage=='USATerms'){WhichHref = 'US-terms.htm'}
if (WhichPage=='AupairFAQ'){WhichHref = 'Aupair-Help.htm'}
if (WhichPage=='FamilyFAQ'){WhichHref = 'Family-Help.htm'}
if (WhichPage=='AupairINFO'){WhichHref = 'aupair-information.htm'}
if (WhichPage=='FamilyINFO'){WhichHref = 'family-information.htm'}
if (WhichPage=='FamilyINFOUSA'){WhichHref = 'US-families.htm'}
if (WhichPage=='VisaInfo'){WhichHref = 'aupair-visas.htm'}
if (WhichPage=='AupairApp'){WhichHref = 'aupair-application.htm'}
if (WhichPage=='FamReg'){WhichHref = 'family-registration.htm'}
if (WhichPage=='AboutUs'){WhichHref = 'about-us.htm'}
if (WhichPage=='Testi'){WhichHref = 'index.html'}
if (WhichPage=='Links'){WhichHref = 'links.html'}


document.location.href=(WhichHref)

}

var months=new Array(13);
months[1]="Jan";
months[2]="Feb";
months[3]="Mar";
months[4]="Apr";
months[5]="May";
months[6]="Jun";
months[7]="Jul";
months[8]="Aug";
months[9]="Sep";
months[10]="Oct";
months[11]="Nov";
months[12]="Dec";
var time=new Date();
var lmonth=months[time.getMonth() + 1];
var date=time.getDate();
var year=time.getYear();
if (navigator.appName == "Netscape"){year=1900 + year;}
year=year.toString()
year=year.substr(2);
var DisplayDate ="<font style='font-face:Courier New,Courier,monospace;font-size:9px'>"+date+"-"+lmonth+"-"+year+"</font>"

//JQuery stuff
if (document.location.href=="http://www.aupair-agency.com/" || document.location.href=="http://aupair-agency.com/" || document.location.href=="http://www.aupair-agency.com/index.html"){

$(function(){
$("div[id*='familyPhoto']").live("mouseover", function(e){
										if ($("body div.NewDiv")) {$("body div.NewDiv").remove();};   
										var thisID = ($(this).attr('id'));			
										var imgElementID = thisID.slice(11);
										var imgSRC="http://www.aupair.ws/AAFImages/"+imgElementID+".jpg";
										var thisleft = 0;
										if (e.pageX >500){thisleft = e.pageX-400;}
										else {thisleft = e.pageX+20;};
										var thistop = 0;									
										var thisposition = "top:"+thistop+"; left:"+thisleft
										$("body").prepend("<div style='position:absolute; border:2px groove brown; padding:3px; background-color:#F5F5DC; z-index:999;"+thisposition+"' Class='NewDiv'><img src='"+imgSRC+"'></Div>");
										var imgHeight = $("div.NewDiv img").height();
										thistop = e.pageY - imgHeight/2;
										$("div.NewDiv").animate({top:thistop}, 1000);
										
										});	
													
$("div[id*='familyPhoto']").live("mouseout", function(e){
													$("body div.NewDiv").remove();
													
													  });
		  
		  
		   });
	  
$(function(){
$("Div.MainMenu").hover(function(){
					$(this).css({'color':'#ffffcc', 'border-color':'#ff3300', 'background-color':'#006699', 'border-width':'2px', 'padding-top':'9px'});
					var whichMenuNumber= $(this).attr('id').charAt(4);			   
					var whichMenu = "MenuE"+whichMenuNumber;
					$("Div[id="+whichMenu+"]").css("visibility","visible");				   
									   
									   }, function(){
										$(this).css({'color':'#006699', 'border-color':'#cccc99', 'background-color':'#ffffcc', 'border-width':'1px', 'border-top-width':'3px', 'padding-top':'10px'});   
									   var whichMenuNumber= $(this).attr('id').charAt(4);			   
									   var whichMenu = "MenuE"+whichMenuNumber;
									   $("Div[id="+whichMenu+"]").css("visibility","hidden");	
									   		   
										
									   });
		   });

$(function(){
$("Div.MenuE").hover(function(){
								$(this).css("visibility", "visible");							  
							  
							  
							  
							  		  }, function(){
										$(this).css("visibility", "hidden");	  
										  
										  }); 
		   
		   })



}


