// JavaScript Document
function validate_email(field,alerttxt){
apos=document.getElementById("email").value
dotpos=document.getElementById("email").value
apos=apos.indexOf("@")
dotpos=dotpos.lastIndexOf(".")
if (apos<1||dotpos-apos<2) {
	alert(alerttxt);return false
	}
else {
	return true
	}

}

function validate_form()
{

if (document.getElementById("login_type1").checked == false && document.getElementById("login_type2").checked == false){
alert("Please indicate if you are a job seeker or a job recruiter by selecting one of the 2 buttons.");return false
}
else if (validate_email("email","Not a valid e-mail address")==false){
document.getElementById("email").focus();return false
}
else if (document.getElementById("password").value=="" || document.getElementById("password").value==null) {
alert("The password field is empty");return false
}
else{
envoyer();
}

}

function envoyer(){
if (document.getElementById("login_type1").checked == true) {
document.__aspnetForm.action="http://peijoblink.evolutra.com:8080/peijoblink/companyLogin";

}
if (document.getElementById("login_type2").checked == true) {
document.__aspnetForm.action="http://peijoblink.evolutra.com:8080/peijoblink/accountLogin";

}
document.__aspnetForm.method="post";
document.__aspnetForm.submit();
}

function linkswitch(){
if (document.getElementById("login_type1").checked == true) {

document.getElementById("register").href="http://peijoblink.evolutra.com:8080/peijoblink/company_MIS/enrol.jsp";
document.getElementById("forgot").href="http://peijoblink.evolutra.com:8080/peijoblink/company_MIS/PasswordEmail.jsp";
}
if (document.getElementById("login_type2").checked == true) {

document.getElementById("register").href="http://peijoblink.evolutra.com:8080/peijoblink/member_MIS/login_info1.jsp?enroll=kafka";
document.getElementById("forgot").href="http://peijoblink.evolutra.com:8080/peijoblink/member_MIS/sendEmail.jsp";
}

}

function checklink(){
	if (document.getElementById("login_type1").checked == false && document.getElementById("login_type2").checked == false) {
	alert("Please indicate if you are a job seeker or a job recruiter by selecting one of the 2 buttons.")
}
}

TipText = new Array() ;

TipText[0]="Did you know this site has a Live Chat function? Get first hand knowledge on everything PEI career and business related.";
TipText[1]="Please take a look at the Calendar of Events to find out about PEI Career Fairs etc...";
TipText[2]="Create a PDF or Word document from the resume you create in the Job Seeker section. Use this resume for all your job searching needs.";
TipText[3]="Visit the Sector Council Sub-Portals for industry related career and business information.";
TipText[4]="Click on Live Help to learn more about this site.";
TipText[5]="Sign up to receive newsletters in the Job Seeker or Recruiter section.";
TipText[6]="Don’t have an e-mail account? Sign up for G-Mail or Hotmail in the Job Seeker area.";
TipText[7]="Have a business or career question – post it on the discussion forum and receive a variety of answers.";
TipText[8]="New to PEI – visit the Immigration / Population Secretariat Sub-Portal for information.";
TipText[9]="Sign up and receive notification of new jobs in PEI."; 
TipText[10]="Receive Live On-Line support by using the Live Help function on this site.";
TipText[11]="When searching for a job or a candidate you can save your favourites to view at a later time.";
TipText[12]="Split off into a private chat room and discuss business or career opportunities in the Live Chat area.";
TipText[13]="Click on &ldquo;What they have to Say&rdquo; to view how other Job Seekers and Recruiters have had success finding a career or a great new recruit.";
 

function tip_switch() {
 
var d = new Date()
var t = new Date()
if (t.getDate()<15) {
d.setDate(1)
} else {
d.setDate(15)
}

var date_tip=t.getDate()-d.getDate()

if (date_tip==14 || date_tip==15 || date_tip==16) {
rnd=Math.round(Math.random()*13)
document.getElementById("tip_text").innerHTML=TipText[rnd];
} else {
document.getElementById("tip_text").innerHTML=TipText[date_tip];
 
}
}

function popup() {
var x=window.location.href;

if (x.indexOf("#")>-1) {
	if (x.indexOf("?")>-1) {
y=x.substring(0,(x.indexOf("#")));
window.open(y+'&templateID=26','_blank');
	}else{
		y=x.substring(0,(x.indexOf("#")));
window.open(y+'?templateID=26','_blank');
	}
}else{
	if (x.indexOf("?")>-1) {
window.open(x+'&templateID=26','_blank');
	}else{
		window.open(x+'?templateID=26','_blank');
	}
}
}

function peiwindow(){
	
window.location="http://www.peijoblink.ca/app"

}


//iFRAMES

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeFrame(frame) 
{
	if (frame && !window.opera) 
	{
	
		frame.style.display="block"
	}

	if (frame.contentDocument) //ns6 syntax
	{
		frame.height = frame.contentDocument.body.offsetHeight+FFextraHeight;
		
		if (frame.height > 32000) 
		{ 
			frame.height = 32000; 
		}
	}
	else if (frame.Document ) //ie5+ syntax
	{
		frame.height = frame.Document.body.scrollHeight+20;
		if (frame.height > 32000) 
		{ 
			frame.height = 32000; 
		} //Maximum allowable height for any element

	}

	//reveal iframe for lower end browsers? (see var above):
	if ((document.all || document.getElementById) && iframehide=="no")
	{
		var tempobj=document.all? document.all(frameid) : document.getElementById(frameid)
		tempobj.style.display="block"
	}
} 




