set_lang_home = function(lang){
	set_cookie('lang', lang, 0, '/', '.impaxinternational.com');
	location.href = 'home.php';
};

set_lang_details = function(lang){
	set_cookie('lang', lang, 0, '/', '.impaxinternational.com');
	qstring = window.location.search.substring(1);
	location.href = 'details.php?'+qstring;
};

set_lang_contact = function(lang){
	set_cookie('lang', lang, 0, '/', '.impaxinternational.com');
	
	// fill in hidden form before submission //
	var f_source = document.getElementById('contactform');
	var f_target = document.getElementById('contacthidden');
	
	if(document.getElementById('login_form')!=null)
	{
		var f_sourcelogin = document.getElementById('login_form');
		f_target.email.value = f_sourcelogin.login_email.value;
		f_target.password.value = f_sourcelogin.login_password.value;
	}
	
	f_target.h_firstname.value = f_source.firstname.value;
	f_target.h_lastname.value = f_source.lastname.value;
	f_target.h_email.value = f_source.cemail.value;
	f_target.h_phone.value = f_source.phone.value;
	f_target.h_skype.value = f_source.skype.value;
	f_target.h_country.value = f_source.country.value;
	f_target.h_port.value = f_source.port.value;
	f_target.h_message.value = f_source.message.value;
	f_target.submit();
};

set_lang_company = function(lang){
	set_cookie('lang', lang, 0, '/', '.impaxinternational.com');
	location.href = 'company.php';
};
set_lang_purchasing = function(lang){
	set_cookie('lang', lang, 0, '/', '.impaxinternational.com');
	location.href = 'purchasing.php';
};
set_lang_faq = function(lang){
	set_cookie('lang', lang, 0, '/', '.impaxinternational.com');
	location.href = 'faq.php';
};

submit_login = function() {
	var f_sourcelogin = document.getElementById('login_form');
	f_sourcelogin.login_submit.value = "true";
	f_sourcelogin.submit();
}

submit_logoff = function() {
	var f_source = document.getElementById('contactform');
	var f_target = document.getElementById('contacthidden');
	
	f_target.logoff_submit.value = "true";

	f_target.h_firstname.value = f_source.firstname.value;
	f_target.h_lastname.value = f_source.lastname.value;
	f_target.h_email.value = f_source.cemail.value;
	f_target.h_phone.value = f_source.phone.value;
	f_target.h_skype.value = f_source.skype.value;
	f_target.h_country.value = f_source.country.value;
	f_target.h_port.value = f_source.port.value;
	f_target.h_message.value = f_source.message.value;
	f_target.submit();
}

set_cookie = function(name, value, expires, path, domain){
	if(expires && path && domain){
		if(expires == 'browser'){
			document.cookie = name + '=' + value + ';path=' + path + ';domain=' + domain;
		}else{
			document.cookie = name + '=' + value + ';expires=' + expires.toGMTString() + ';path=' + path + ';domain=' + domain;
		}
	}else if(expires && path){
		document.cookie = name + '=' + value + ';expires=' + expires.toGMTString() + ';path=' + path + ';';
	}else if(expires){
		document.cookie = name + '=' + value + ';expires=' + expires.toGMTString() + ';';
	}else{
		document.cookie = name + '=' + value + ';';
	}	
};


get_cookie = function(name){
	var search = name;
	var returnval = '';

	if(document.cookie.length > 0){
		offset = document.cookie.indexOf(search);
		if(offset != -1){
			offset += search.length+1;
			end = document.cookie.indexOf(';', offset);
			if(end == -1){
				end = document.cookie.length;
			}
			returnval = unescape(document.cookie.substring(offset, end));
		}
	}
	return returnval;
};

//<!-- EDGAR ADDITIONS
var imgID = 0;
function change_img_id(id){
	imgID=id; 
}
function view_details(){
	location.href = 'details.php?id='+imgID;
}
function view_details_results(){
	location.href = 'details.php?link=true&id='+imgID;
}
function view_details_nohistory(){
	document.location.replace('details.php?id='+imgID);
}
function popup(current_id){
	window.open('popup.php?id='+current_id,current_id,'width=650,height=450,left=20,top=20,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');
}

function toggleBox(szDivID, iState){
    if(document.layers){
       document.layers[szDivID].visibility = iState ? "show" : "hide";
	   document.layers[szDivID].zIndex = "302";
    }
    else if(document.getElementById){
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
		obj.style.zIndex = "302";
    }
    else if(document.all){
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
		document.all[szDivID].style.zIndex = "302";
    }
}
function changeText(txt,id){
	document.getElementById('category_txt').innerHTML = txt;
	document.getElementById('vehicletype_value').value = id;
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	document.getElementById('category_txt').innerHTML = curleft+" "+curtop;
	return [curleft,curtop];
}

function setLyr(obj,lyr){
	var coors = findPos(obj);
	//coors[1] -= 155;
	//coors[0] -= 475;
	var x = document.getElementById(lyr);
	x.style.top = coors[1] + 'px';
	x.style.left = coors[0] + 'px';
	x.style.visibility = 'visible';
}



// -->
//<!-- END EDGAR ADDITIONS
