<!--
// for search submission
function submitsearch() {
var msg = "You need type a keyword to start search";
var space = "";
var twospace = " ";

if (window.document.forms.srch.keyword.value == space ||window.document.forms.srch.keyword.value == twospace) {
	alert(msg);
        return false;
   }
   else {
        window.document.forms.srch.submit();
        return true;
   }
}

function popup() {
     if (iSectionID = 2) {
        window.open('/promo/freedvd.htm','Promo','height=380,width=410');
        
  }
}




// for compare page
function changeImage(sel)
	{
//	 var trimname
//	check duplicate selection
	if (! valid(sel))
		{
		switch(sel)
			{
			case 1:
				window.document.forms.compare.product1.selectedIndex=0
				break
			case 2:
				window.document.forms.compare.product2.selectedIndex=0
				break
	                case 3:
				window.document.forms.compare.product3.selectedIndex=0
				break
			case 4:
				window.document.forms.compare.product4.selectedIndex=0
				break
			}
		ImageSwapRemove(sel)
		return true
		}
	ImageSwap(sel)
	}
function ImageSwapRemove(sel)
	{
	if (sel==1)
		{
        	document.s1.src="en/images/sp.gif"
		}
	else if (sel==2)
		{
        	document.s2.src="en/images/sp.gif"
		}
	else if (sel==3)
		{
        	document.s3.src="en/images/sp.gif"
		}
	else if (sel==4)
		{
        	document.s4.src="en/images/sp.gif"
		}
	}
//change image
function ImageSwap(sel)
	{
        var trimname, pos, strarray
	if (sel==1)
		{
 		trimname=document.forms.compare.product1.options[document.forms.compare.product1.selectedIndex].value
                pos = trimname.indexOf(";")
   		document.s1.src=trimname.substring(0, pos)
                if (document.forms.compare.product1.selectedIndex == 0) 
                     {
                     document.s1.src="en/images/sp.gif"
                     }

		}
	else if (sel==2)
		{
		trimname=document.forms.compare.product2.options[document.forms.compare.product2.selectedIndex].value
                pos = trimname.indexOf(";")
		document.s2.src=trimname.substring(0, pos)
                if (document.forms.compare.product2.selectedIndex == 0) 
                     {
                     document.s2.src="en/images/sp.gif"
                     }

		}
	else if (sel==3)
		{
		trimname=document.forms.compare.product3.options[document.forms.compare.product3.selectedIndex].value
                pos = trimname.indexOf(";")
		document.s3.src=trimname.substring(0, pos)
                if (document.forms.compare.product3.selectedIndex == 0) 
                     {
                     document.s3.src="en/images/sp.gif"
                     }
		}
	else if (sel==4)
		{
		trimname=document.forms.compare.product4.options[document.forms.compare.product4.selectedIndex].value
                pos = trimname.indexOf(";")
		document.s4.src=trimname.substring(0, pos)
                if (document.forms.compare.product4.selectedIndex == 0) 
                     {
                     document.s4.src="en/images/sp.gif"
                     }
		}	
		
	return true
	}

function valid(sel)
	{
	var sel1,sel2,sel3, sel4
	sel1=document.forms.compare.product1.selectedIndex
	sel2=document.forms.compare.product2.selectedIndex
	sel3=document.forms.compare.product3.selectedIndex
	//sel4=document.forms.compare.product4.selectedIndex
		

	if (sel1==0) {sel1=10001}
	if (sel2==0) {sel2=10002}
	if (sel3==0) {sel3=10003} 
	if (sel4==0) {sel4=10004} 
	//if ((sel1==sel2) || (sel1==sel3) || (sel1==sel4) || (sel2==sel3) || (sel3==sel4) || (sel2==sel4)){
        if ((sel1==sel2) || (sel1==sel3) || (sel2==sel3)) {
	  alert("You have selected this product already.")
	  return false}
	else {
	  return true  
	}
}


function compareSubmit()
{
var sel1,sel2,sel3,sel4, msg
var selTrim1,selTrim2,selTrim3
msg="You must select at least two products for comparision"
msgd="You can not select the same product more than once for comparision"

sel1=document.forms.compare.product1.selectedIndex
sel2=document.forms.compare.product2.selectedIndex
sel3=document.forms.compare.product3.selectedIndex
//sel4=document.forms.compare.product4.selectedIndex

//check
//if (sel1==0 && sel2==0 && sel3==0 && sel4==0)  {alert(msg);return false}
if (sel1==0 && sel2==0 && sel3==0)  {alert(msg);return false}
//if ((sel1==0 && sel2==0 && sel3==0) || (sel1==0 && sel2==0 && sel4==0) || (sel2==0 && sel3==0&& sel4==0) || (sel1==0 && sel3==0&& sel4==0))  {alert(msg);return false}
if ((sel1==0 && sel2==0) || (sel1==0 && sel3==0) || (sel2==0 && sel3==0))  {alert(msg);return false}
//if (((sel1!=0) && ((sel1==sel2) ||(sel1==sel3) ||(sel1==sel4)))||((sel2!=0) && ((sel2==sel3) ||(sel2==sel4))) ||((sel3!=0) && (sel3==sel4))) {alert(msgd);return false}
if (((sel1!=0) && ((sel1==sel2) ||(sel1==sel3)))||((sel2!=0) && (sel2==sel3))) {alert(msgd);return false}

}

function sendemail() {
msg="";
hasemail=false;
    with (document.forms["emailpdf"]) {
        if (sender.value.length == 0) { // sender email address is required
	    msg = "Please provide your email address\n";
        } else {
           if (!validEmailAddress(sender.value, false)) // validate sender email address
	        msg = msg + "Your email address is not valid\n";
        }

	if (email1.value.length > 0) {
             hasemail = true;
             if (!validEmailAddress(email1.value, false))
                    msg = msg + "First email address is not valid\n";
        }

	if (email2.value.length > 0) {
             hasemail = true;
             if (!validEmailAddress(email2.value, false))
                    msg = msg + "Second email address is not valid\n";
        }
	if (email3.value.length > 0) {
             hasemail = true;
             if (!validEmailAddress(email3.value, false))
                    msg = msg + "Third email address is not valid\n";
        }
	if (email4.value.length > 0) {
             hasemail = true;
             if (!validEmailAddress(email4.value, false))
                    msg = msg + "Fourth email address is not valid\n";
        }
	if (email5.value.length > 0) {
             hasemail = true;
             if (!validEmailAddress(email5.value, false))
                    msg = msg + "Fifth email address is not valid\n";
        }

	if (!hasemail) {
               msg = msg + "Provide at least one address to receive the email.\n";
	}
    }
	if (msg.length > 0)
		alert(msg);
	return (msg.length == 0);

}


function validEmailAddress(email, allowempty) {
	if (email.length == 0)
		return allowempty;
	a = email.split('@');
	if (a.length == 2) {
		if (a[0].length >= 2 && a[1].length >= 5) {
			//a = email.split('.');
			//if (a.length >= 2) {
				//for(i=0; i < a.length; i++) {
					//if (a[i].length < 2)
						//return false;
				//}
				return true;
			//}
		}
	}
	return false;
}


function recompare() {
    if(window.opener.closed) {
        document.returntocompare.submit();
    } else {
        window.opener.focus();
        window.opener.document.forms["returntocompare"].submit();
        window.close();
    }
    return true;
}


//-->



function writeflash_ad() {
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="320" height="230" id="wasp95303" name="wasp95303" align="middle">');
document.write('<param name="allowScriptAccess" value="sameDomain">');
document.write('<param name="movie" value="wasp.swf">');
document.write('<param name="loop" value="false">');
document.write('<param name="menu" value="false">');
document.write('<param name="quality" value="high">');
document.write('<param name="scale" value="noscale">');
document.write('<param name="salign" value="lt">');
document.write('<param name="bgcolor" value="#000000">');
document.write('<param name="flashvars" value="theFile=media/org_ad.flv&startPlayingOnload=yes&bufferSeconds=5&videoSmoothing=yes">');
document.write('<embed src="wasp.swf" flashvars="theFile=media/org_ad.flv&startPlayingOnload=yes&bufferSeconds=5&videoSmoothing=yes" loop="false" menu="false" quality="high" scale="noscale" salign="lt" width="320" height="230" name="wasp95303" align="middle" bgcolor="#000000" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');

document.write('</object>');
}
