// JavaScript Document

    //Ajax

	var xmlHttp;

	function createXMLHttpRequest(){

		if(window.ActiveXObject){

			xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');

		}

		else if(window.XMLHttpRequest){

			xmlHttp = new XMLHttpRequest();

		}

	}

	

	createXMLHttpRequest();//creat Object

	

	function readrecap(val){

		//get data

		//link the server

		var url = "../includes/ajax.php?function=getrecap&recapid="+val;

		//open the link

		xmlHttp.open("GET", url, true);

		//

		xmlHttp.onreadystatechange=after_readrecap;

		//

		xmlHttp.send(null);

	}



	function after_readrecap()

	{

		if(xmlHttp.readyState==4){

			response = xmlHttp.responseText;

			if(response==-1){

				alert('Errors In Getting the portfolio Html Information.');

			}else

			{

				document.getElementById('mainportfolio').innerHTML = '';

				document.getElementById('mainportfolio').innerHTML = response;

			}

		}

	}



	function readIndustry(val){

		//get data

		//link the server

		var url = "../includes/ajax.php?function=getindustry&industryId="+val;

		//open the link

		xmlHttp.open("GET", url, true);

		//

		xmlHttp.onreadystatechange=after_readIndustry;

		//

		xmlHttp.send(null);

	}



	function after_readIndustry()

	{

		if(xmlHttp.readyState==4){

			response = xmlHttp.responseText;

			if(response==-1){

				alert('Errors In Getting the portfolio Html Information.');

			}else

			{

				document.getElementById('list_site').innerHTML = '';

				document.getElementById('list_site').innerHTML = response;

			}

		}

	}

	function readSkill(val){

		//get data

		//link the server

		var url = "../includes/ajax.php?function=getskill&skillId="+val;

		//open the link

		xmlHttp.open("GET", url, true);

		//

		xmlHttp.onreadystatechange=after_readSkill;

		//

		xmlHttp.send(null);

	}



	function after_readSkill()

	{

		if(xmlHttp.readyState==4){

			response = xmlHttp.responseText;

			if(response==-1){

				alert('Errors In Getting the portfolio Html Information.');

			}else

			{

				document.getElementById('list_site').innerHTML = '';

				document.getElementById('list_site').innerHTML = response;

			}

		}

	}

	
	function readIndustryIDs(val){

		//get data

		//link the server

		var url = "../includes/ajax.php?function=getindustryids&industryId="+val;

		//open the link

		xmlHttp.open("GET", url, true);

		//

		xmlHttp.onreadystatechange=after_readIndustryIDs;

		//

		xmlHttp.send(null);

	}



	function after_readIndustryIDs()

	{

		if(xmlHttp.readyState==4){

			response = xmlHttp.responseText;
//			var myArray = eval( xmlHttp.responseText );
			if(response==-1){

				alert('Errors In Getting the portfolio Html Information.');

			}else

			{
				alert(response);

//				document.getElementById('list_site').innerHTML = '';
//
//				document.getElementById('list_site').innerHTML = response;

			}

		}

	}


	function readSkillIDs(val){

		//get data

		//link the server

		var url = "../includes/ajax.php?function=getskillids&skillId="+val;

		//open the link

		xmlHttp.open("GET", url, true);

		//

		xmlHttp.onreadystatechange=after_readSkillIDs;

		//

		xmlHttp.send(null);

	}



	function after_readSkillIDs()

	{

		if(xmlHttp.readyState==4){

			response = xmlHttp.responseText;

			if(response==-1){

				alert('Errors In Getting the portfolio Html Information.');

			}else

			{
				alert(response);

/*				document.getElementById('list_site').innerHTML = '';

				document.getElementById('list_site').innerHTML = response;*/

			}

		}

	}
	


	

	

	function checkEmail(val){

		//get data

		//link the server

		var url = "../includes/ajax.php?function=checkEmails&email="+val;

		//open the link

		xmlHttp.open("GET", url, true);

		//

		xmlHttp.onreadystatechange=after_checkEmail;

		//

		xmlHttp.send(null);

	}



	function after_checkEmail()

	{

		if(xmlHttp.readyState==4){

			response = xmlHttp.responseText;

			if(response==-1){

				alert('Errors In Getting the portfolio Html Information.');

			}else

			{

				document.getElementById('formError').innerHTML = '';

				document.getElementById('formError').innerHTML = response;

			}

		}

	}

	

	

	function checkCaptcha(val){
		//get data
		//link the server
		var url = "../includes/ajax.php?function=checkCaptcha&code="+val;
		//open the link
		xmlHttp.open("GET", url, false);
		//
		xmlHttp.onreadystatechange=after_checkCaptcha;
		//
		xmlHttp.send(null);
		
		//just for Firefox, because for Firefox, it doesn't run function in onreadystatechange.
		if (navigator.userAgent.indexOf("MSIE")==-1){
			response = xmlHttp.responseText;
			if(response=='-1'){
				alert('Errors In Getting the Email Information.');
				bValidateForm = false;
			}else
			if(response=='-2')
			{
				document.getElementById('formError').innerHTML = '';
				document.getElementById('formError').innerHTML = 'Please try the code again.';
				document.getElementById('captchacode').value = '';
				document.getElementById('captchacode').focus();
				bValidateForm = false;
			}else
			{
				bValidateForm = true;
			}
		}
	}
	
	function after_checkCaptcha()
	{
		if(xmlHttp.readyState==4){
			response = xmlHttp.responseText;
			if(response=='-1'){
				alert('Errors In Getting the Email Information.');
				bValidateForm = false;
			}else
			if(response=='-2')
			{
				document.getElementById('formError').innerHTML = '';
				document.getElementById('formError').innerHTML = 'Please try the code again.';
				document.getElementById('captchacode').value = '';
				document.getElementById('captchacode').focus();
				bValidateForm = false;
			}else
			{
				bValidateForm = true;
			}
		}
	}

