/////////////////	onload	/////////////////
window.onload = function (){
var allA = document.getElementById('main').getElementsByTagName('a');
	for(var i=0;i<allA.length;i++){
		allA[i].onmouseover = function (){window.status = this.title;return true}
		allA[i].onmouseout = function (){window.status = '';return true}
	}

};

/////////////////	end onload	/////////////////

var win=null;
function popWindow(mypage,myname,w,h,scroll){

LeftPosition=(screen.width)?(screen.width-w)/2:100;
TopPosition=(screen.height)?(screen.height-h)/2:100;

settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);

};

/////////////

function isEmail(string){
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1){
		return true;
	}else{
		return false;
	}
};

function capitalize(obj){
	val = obj.value;
	newVal = '';
	val = val.split(' ');
	for(var c=0; c < val.length; c++){
		newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length) + ' ';
	}
	obj.value = newVal;
};

function getCookie(Name) { 
var re = new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if(document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
		return null
};

/////////////

function doSelected(x, y){
	
	var select_box = document.getElementById(y);

	for(i = 0 ; i < select_box.length ; i++){
		if(select_box.options[i].value == x){
		select_box.options[i].selected="selected";
		}
	}
};

/////////////
function readService(x){

var aChild=document.getElementById('servicesPack').getElementsByTagName("a");

	for( var i=0; i<aChild.length; i++ ){
		aChild[i].className = 'serviceBox';
	}

	document.getElementById(x).className = 'serviceBoxOn';

	var url="ajax_services.asp?section="+x;

	url=uncache(url);
	callInProgress(request);
	request.open("GET", url, true);
	request.onreadystatechange = readServiceResponse;
	request.send(null);
};

function readServiceResponse(){
if(request.readyState==4 && request.status==200){
	document.getElementById("services").innerHTML = request.responseText;
}else{
	document.getElementById("services").innerHTML="<div style='width:100%;height:200px;'><br /><img style='margin:80px 0 0 130px;' src='images/_loader.gif' alt='Please wait' /></div>";
}
};

/////////////

function notifiedEnquiry(strLang){

var errorMsg = new Array();

var Fname = document.getElementById("strFirstName").value;
var Lname = document.getElementById("strLastName").value;
var countryL = document.getElementById("strCountry").value;
var Email = document.getElementById("strEmail").value;
var company = document.getElementById("strCompany").value;
var Occupation = document.getElementById("strOccupation").value;
var recaptcha_response_field = document.getElementById("recaptcha_response_field").value;

var intWord = "*";
var theresult = "pass"
var errorImg = "<img src='images/_error.gif' alt='!' />"

//var readCookie = getCookie('liquidLang');

switch(strLang){
case "fr":
	errorMsg[1] = " Merci d'indiquer votre pr&eacute;nom.";
	errorMsg[2] = " Merci d'indiquer votre nom.";
	errorMsg[3] = " Merci d'indiquer votre email.";
	errorMsg[4] = " Cette adresse email n'est pas valide.";
	errorMsg[5] = " Merci d'indiquer un pays.";
	errorMsg[6] = " Merci d'indiquer la soci&eacute;t&eacute;.";
	errorMsg[7] = " Merci d'indiquer votre position.";
	errorMsg[8] = " Merci d'entrer le(s) mot(s) indiqué(s)";
break
default:
	errorMsg[1] = " Please enter your name.";
	errorMsg[2] = " Please enter your surname.";
	errorMsg[3] = " Please enter your email address.";
	errorMsg[4] = " This email address is invalid.";
	errorMsg[5] = " Please enter your country of residence.";
	errorMsg[6] = " Please enter your company name.";
	errorMsg[7] = " Please enter your occupation.";
	errorMsg[8] = " Please enter the words depicted.";
}

	if(Fname.length <= 0){
		document.getElementById("error_Fname").innerHTML = errorImg + errorMsg[1];
		theresult = "not pass"
	}else{
		document.getElementById("error_Fname").innerHTML = intWord;
	}
	if(Lname.length <= 0){
		document.getElementById("error_Lname").innerHTML = errorImg + errorMsg[2];
		theresult = "not pass"
	}else{
		document.getElementById("error_Lname").innerHTML = intWord;
	}
	if(countryL.length <= 0){
		document.getElementById("error_country").innerHTML = errorImg + errorMsg[5];
		theresult = "not pass"
	}else{
		document.getElementById("error_country").innerHTML = "";
	}
	if(Email.length <= 0){
		document.getElementById("error_email").innerHTML = errorImg + errorMsg[3];
		theresult = "not pass"
	}else if(isEmail(Email) == false){
		document.getElementById("error_email").innerHTML = errorImg + errorMsg[4];
		theresult = "not pass"
	}else{
		document.getElementById("error_email").innerHTML = intWord;
	}
	if(company.length <= 0){
		document.getElementById("error_company").innerHTML = errorImg + errorMsg[6];
		theresult = "not pass"
	}else{
		document.getElementById("error_company").innerHTML = intWord;
	}
	if(Occupation.length <= 0){
		document.getElementById("error_occupation").innerHTML = errorImg + errorMsg[7];
		theresult = "not pass"
	}else{
		document.getElementById("error_occupation").innerHTML = intWord;
	}

	if(recaptcha_response_field.length <= 0){
		document.getElementById("error_recaptcha").innerHTML = errorImg + errorMsg[8];
		document.getElementById("error_recaptcha").style.margin = "120px 0px 0px 0px";
		theresult = "not pass"
	}else{
		document.getElementById("error_recaptcha").innerHTML = intWord;
	}

if(theresult == "pass"){
	return true;
}else{
	return false;
}

};