// JavaScript Document

//news ajax

function page(mpurl)

{

	$("div#news_list").load(mpurl);

}

//events ajax

function page_events(mpurl)

{

	$("div#events_list").load(mpurl);

}

//affiliations ajax

function page_affiliations(mpurl)

{

	$("div#affiliations_list").load(mpurl);

}

//awards ajax

function page_awards(mpurl)

{

	$("div#awards_list").load(mpurl);

}

function page_search(mpurl)
{
	$("div#search_list").load(mpurl);
}

function page_search_news(mpurl)
{
	$("div#search_news_list").load(mpurl);
}
function page_search_category(mpurl)
{
	$("div#search_category_list").load(mpurl);
}

//dan effects

function viewNews(id){

	$("#news_"+id).toggle();

	if($("#news_status_ico_"+id).attr("alt")=="View"){

		$("#news_status_ico_"+id).attr("src","images/close.gif");

		$("#news_status_ico_"+id).attr("alt","Close");

	}

	else {

		$("#news_status_ico_"+id).attr("src","images/open.gif");

		$("#news_status_ico_"+id).attr("alt","View");

	}

}

function viewEvents(id){

	$("#events_"+id).toggle();

	if($("#events_status_ico_"+id).attr("alt")=="View"){

		$("#events_status_ico_"+id).attr("src","images/close.gif");

		$("#events_status_ico_"+id).attr("alt","Close");

	}

	else {

		$("#events_status_ico_"+id).attr("src","images/open.gif");

		$("#events_status_ico_"+id).attr("alt","View");

	}

}

function viewResources(id){

	$("#resources_"+id).toggle();

}

function viewFaq(id){

	$("#faq_"+id).toggle();

}

function change()//search

{

		$("input#KeyWords").val("");

}

function change2()//enewsletter

{

		$("input#email_address").val("");

}

function tiaozhuan(type)

{

	if(type ==1)//search jobs

	{

			var temp = $("#sj").val();

			if(temp == 1)

			{

				window.open("http://www.ssaust.com.au/english/jobopps.html","winsj1");
				

			}

			if(temp == 2)

			{

				window.open("http://www.ata-rh.com.br/eng/index.php","winsj2");

			}

			if(temp == 3)

			{

				//window.open("http://special.zhaopin.com/sh/2008/FR112624/index.htm","winsj3");	
				window.open("http://special.zhaopin.com/sh/2009/FR021624/index.htm","winsj3");

			}

			if(temp == 4)

			{

				window.open("http://www.partnerinterim.com","winsj4");

			}

			if(temp == 5)

			{

				window.open("http://210.17.247.33:8888/AdaptWSC/","winsj5");

			}

			if(temp == 6)

			{

				window.open( "http://www.workplus.hu/index.php?lang=huen","winsj6");

			}

			if(temp == 7)

			{

				window.open("http://www.selnarecruitment.com/eng/depts.asp","winsj7");

			}

			/*if(temp == 8)

			{

				window.open(" http://www.jobspa.it/html/hp_candidato.jsp","winsj8");

			}*/

			if(temp == 9)

			{

				window.open("http://www.jp.farorecruitment.com","winsj9");

			}

			if(temp == 11)

			{

				window.open( "http://www.jobsdb.com.sg/SG/EN/V6/cobrand/JobSearch.asp?PN=JobListing&RecordsPerPage=20&searchtext=%22FARO%20RECRUITMENT%22&KeywordSearchFields=Companies","winsj11");
			}

			if(temp == 12)

			{

				window.open( " http://www.algconsultores.es","winsj12");

			}

			if(temp == 13)

			{

				//window.open( "http://www.interiman.ch/candidate/index.php","winsj13");
				
				window.open( "http://www.interiman-group.ch","winsj13");

			}

			if(temp == 14)

			{

				window.open( "http://www.alink.co.th/en/hotjob.php","winsj14");

			}

			if(temp == 15)

			{

				//window.open( "http://www.people-first.co.uk/officesupport/vacancy-search.asp","winsj15");
				window.open( "http://www.farorecruitment.com/chooes2.php","winsj15");

			}

			if(temp == 16)

			{

				window.open( "http://www.qristaffing.com/seacr.php","winsj16");

			}

			if(temp == 17)

			{

				//window.open( "./pdf/01 Jul 2009 - Job Listing.doc","winsj17");
				window.open("http://www.farorecruitment.com.vn/Default.aspx","winsj17");

			}

	}

	else

	{

		var temp = $("#sc").val();//Services by country

			if(temp == 1)

			{

				window.open("http://www.ssaust.com.au/english/index.html","winsc1");

			}

			if(temp == 2)

			{

				window.open( "http://www.ata-rh.com.br/eng/index.php","winsc2");

			}

			if(temp == 3)

			{

				window.open( "China.php","winsc3");

			}

			if(temp == 4)

			{

				window.open( "http://www.partnerinterim.com","winsc4");

			}

			if(temp == 5)

			{

				window.open( "http://www.hk.farorecruitment.com/","winsc5");

			}

			if(temp == 6)

			{

				window.open( "http://www.workplus.hu/index.php?lang=huen","winsc6");

			}

			if(temp == 7)

			{

				window.open("http://www.selnajaya.com","winsc7");

			}

			/*if(temp == 8)

			{

				window.open("http://www.jobspa.it","winsc8");
			}*/

			if(temp == 9)

			{

				window.open("http://www.jp.farorecruitment.com","winsc9");

			}
			if(temp == 11)

			{

				window.open( "Singapore.php","winsc11");

			}

			if(temp == 12)

			{

				window.open( "  http://www.algconsultores.es","winsc12");

			}

			if(temp == 13)

			{

				//window.open( "http://www.interiman.ch","winsc13");
				window.open( "http://www.interiman-group.ch","winsc13");

			}

			if(temp == 14)

			{

				window.open( "http://www.alink.co.th/en/indexemployer.php","winsc14");

			}

			if(temp == 15)

			{

				//window.open("http://www.people-first.co.uk/default.asp","winsc15");//chooes.php
				window.open("http://www.farorecruitment.com/chooes.php","winsc15");
			}

			if(temp == 16)

			{

				//window.open("http://www.qristaffing.com/index.php","winsc16");
				window.open("http://www.monroestaffing.com","winsc16");

			}

			if(temp == 17)

			{

				window.open( "http://www.vn.farorecruitment.com","winsc17");

			}

	}



}

function checkmail()

{

    var email=$("#email_address").val();

    var pattern=/^([a-zA-Z0-9_-])+(\.)+([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
	var pattern2=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;

    flag=pattern.test(email);
	flag2=pattern2.test(email); 

    if (flag)
	{

		$("#test").load("insert_email.php", {email:email}, function(){

   				alert("The application is successful.");

 		}); 

		return false;
}
else if(flag2)
{
	$("#test").load("insert_email.php", {email:email}, function(){

   				alert("The application is successful.");

 		}); 

}
else
{
	 alert('Please input a valid email address.');
	 return false;
}

}