/////////////////	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}
	}


window.moveTo(0,0);
if(document.all){
	window.resizeTo(screen.availWidth, screen.availHeight);
}else if(document.layers || document.getElementById){
	if(window.outerHeight < screen.availHeight || window.outerWidth < screen.availWidth){
		window.outerHeight = screen.availHeight;
		window.outerWidth = screen.availWidth;
	}
}

};

/////////////////	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 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 login(){

var userId = document.getElementById("strUser").value;
var pw = document.getElementById("strPw").value;
var intWord = "";
var theresult = "pass"
var errorImg = "<img src='images/_error.gif' alt='!' />"

	if(userId.length <= 0){
		document.getElementById("error_user").innerHTML = errorImg + " Please enter your username.";
		theresult = "not pass"
	}else{
		document.getElementById("error_user").innerHTML = intWord;
	}
	if(pw.length <= 0){
		document.getElementById("error_pw").innerHTML = errorImg + " Please enter your password";
		theresult = "not pass"
	}else{
		document.getElementById("error_pw").innerHTML = intWord;
	}

if(theresult == "pass"){
	return true;
}else{
	return false;
}

};

function notifiedEnquiry(){

var Fname = document.getElementById("strFirstName").value;
var Lname = document.getElementById("strLastName").value;
var company = document.getElementById("strCompany").value;
var Email = document.getElementById("strEmail").value;
var subject = document.getElementById("strSubject").value;
var msg = document.getElementById("strMsg").value;

var intWord = "*";
var theresult = "pass";
var errorImg = "<img src='images/_error.gif' alt='!' />";

	if(Fname.length <= 0){
		document.getElementById("error_fname").innerHTML = errorImg + " Please enter your name.";
		theresult = "not pass"
	}else{
		document.getElementById("error_fname").innerHTML = intWord;
	}
	if(Lname.length <= 0){
		document.getElementById("error_lname").innerHTML = errorImg + " Please enter your surname.";
		theresult = "not pass"
	}else{
		document.getElementById("error_lname").innerHTML = intWord;
	}
	if(company.length <= 0){
		document.getElementById("error_company").innerHTML = errorImg + " Please enter your company name.";
		theresult = "not pass"
	}else{
		document.getElementById("error_country").innerHTML = intWord;
	}
	if(Email.length <= 0){
		document.getElementById("error_email").innerHTML = errorImg + " Please enter your email address.";
		theresult = "not pass"
	}else if(isEmail(Email) == false){
		document.getElementById("error_email").innerHTML = errorImg + " This email address is invalid.";
		theresult = "not pass"
	}else{
		document.getElementById("error_email").innerHTML = intWord;
	}
	if(subject.length <= 0){
		document.getElementById("error_subject").innerHTML = errorImg + " Please select subject.";
		theresult = "not pass"
	}else{
		document.getElementById("error_subject").innerHTML = intWord;
	}
	if(msg.length <= 0){
		document.getElementById("error_msg").innerHTML = "<br /><label>&nbsp;</label>" + errorImg + " Please enter your message.";
		theresult = "not pass"
	}else{
		document.getElementById("error_msg").innerHTML = intWord;
	}

if(theresult == "pass"){
	return true;
}else{
	return false;
}

};