function MyOpenURL(page) {
		  window.open(page);
}
		  
function languageSelect(selObj){
		var langForm = document.getElementById("formlanguageselector");

		if (langForm.language.value=="czbak"){
			location.href="http://www.hitachi-online.cz";
		}else if (langForm.language.value=="plbak"){
			location.href="http://www.hitachi-online.pl";
		}else if (langForm.language.value=="hu"){
			location.href="http://www.hitachi-ee.com/hu";
		}else if (langForm.language.value=="si"){
			location.href="http://www.hitachi-online.si";
		}else if (langForm.language.value=="hr"){
			location.href="http://www.hitachi-ee.com/hr";
		}else if (langForm.language.value=="ro"){
			location.href="http://www.hitachi-online.ro";
		}else{
			langForm.action = "homepage.do?actionName=language";
			langForm.submit();		
		}		
} 
function quickProductSearch(selObj){
		var langForm = document.getElementById("productSearchType");
		langForm.action = "quickProductSearchType.do?actionName=goSearchProductAction";
		langForm.submit();				
}

function changeProductType(selObj){
		var productForm = document.getElementById("productType");
		productForm.action = "wheretoBuy.do?actionName=changeProductType";
		productForm.submit();				
} 

function validatelogin()
{
    form = document.forms[0];
    if (form.username2.value == "")
        alert("You must enter a username");
    else if (form.password.value == "")
        alert("You must enter a password");
    else
    {
       form.CMD.value = "LOGIN";
       form.submit();
    }
}

function changeWhereToBuyProductType(){
	var whereToBuyForm = document.getElementById("buyProductType");
	whereToBuyForm.action  = "wheretoBuy.do?actionName=changeProductType";
}


function MyOpenURL(page) {
	window.open(page);
}

function exchangeProduct(imgurl,enlarge){
    document.getElementById("productimg").src="/graphics/products/" + imgurl;
    document.getElementById("enlarge").value="/graphics/products/" + enlarge;
}

function formSubmitWithLink(form,link){
	form.action=link;
	form.submit();
}

function formSubmitWithLinkForUK(form,link,thisvalue){
	form.productTypeID.value = thisvalue;
	form.action=link;
	form.submit();
}

function centrepop(url,sx,sy) {
	var winl = (screen.width-sx)/2;
	var wint = (screen.height-sy)/2;
  popupwin=window.open(url,"popup","toolbar=no,location=no,resizable=yes,directories=yes,status=no,statusbar=no,menubar=no,scrollbars=yes,top="+wint+",left="+winl+",width="+sx+",height="+sy+"");

}

function productCompare(form,num){
	var total="";
		if (num>1){
			for(var i=0; i < form.compro.length; i++){
				if(form.compro[i].checked)
					total +=form.compro[i].value + "-";
					form.compro[i].checked=false;
			}
		}else{
			if (document.getElementById("compro").checked)
				total +=document.getElementById("compro").value;
				document.getElementById("compro").checked=false;
		}

	if (total!=""){
		centrepop("productwizard.jsp?prolist=" + total,1000,650);
	}
}

function productCompareOne(pid){
	centrepop("productwizard.jsp?prolist=" + pid,1000,650);
}


function goto_URL(object) {

	if (object.options[object.selectedIndex].value != "null") {

		window.location.href = object.options[object.selectedIndex].value;

	}

}

function submitForm(selObj){
  document.contactForm.actionName.value=selObj
  document.contactForm.submit();
}

function showLarge() {
		var im = document.getElementById("enlarge").value;
    popup2 = window.open('showImage.jsp?imageurl=' + im, 'largeImage', 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=no,width=800,height=600,top=50,left=140');
    setTimeout('popup2.focus();',250);
}

function popup(width,height,loc) {
    xpos = (640 - width)/2;
	ypos = (480 - height)/2;

    if (screen) {
        ypos = (screen.availHeight - height)/2;
        xpos = (screen.availWidth - width)/2;
    }

	popup4 = 
window.open(loc,"newWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,width="+width+",height="+height+",screenX="+xpos+",screenY="+ypos+",top="+ypos+",left="+xpos+",scrollbars=no");
    setTimeout('popup4.focus();',250);
}

function popup2(width,height,loc) {
    xpos = (640 - width)/2;
	ypos = (480 - height)/2;

    if (screen) {
        ypos = (screen.availHeight - height)/2;
        xpos = (screen.availWidth - width)/2;
    }
var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;

if (ie7 == true) {
        
        width = width + 18;
}
	popup4 = window.open(loc,"newWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,width="+width+",height="+height+",screenX="+xpos+",screenY="+ypos+",top="+ypos+",left="+xpos+",scrollbars=yes");

    setTimeout('popup4.focus();',250);
}

function togglepage(objSomeText) {
	var returnstr = "";
	if (objSomeText.value) {
		returnstr = symbolsToEntities(objSomeText.value);
	}
	return returnstr;
}

function symbolsToEntities(sText) {
	var sNewText = "";
	var iLen = sText.length;
	for (i=0; i<iLen; i++) {
		iCode = sText.charCodeAt(i);
		sNewText += (iCode > 256? "&#" + iCode + ";": sText.charAt(i));
	}
	return sNewText;
} 




function formSubmitWithLinkForUKReview(form,link,thisvalue){
	try{
		document.dealerForm.productGroupID.value = -1;
	}catch(err){}
	try{
		document.dealerForm.productID.value = -1;
	}catch(err){}
	form.productTypeID.value = thisvalue;
	form.action=link;
	form.submit();
}