/* FUNCTION FOR SHOW HIDE 
Comments added by John M. The below function was causing an error in Firefox. The new show_hide function works 
and was added 10-Sept 07. Assuming three are no other diffiuclties this first show_hide can be removed at a later date
function show_hide(element){
	//alert(window.pageYOffset);
	//alert(document.body.scrollTop);
	if (eval(element+'.style.display=="none"')){
		eval(element+'.style.display=""')
	}
	else
	{
		eval(element+'.style.display="none"')
	}
}*/
function buttonChange( obj, url ) {
  if (document.images) {
    obj.src = url;
  }
}

function show_hide(element)
{

  	var e = document.getElementById(element);
	if (e.style.display =='none')
	{
		e.style.display='block';
	}
	else
	{
		e.style.display='none';
	}
}

/*Created by JM. This is ussed by the textarea to show always after the onclick event*/
function show(element)
{
    //var d = element.value;
	//var f = d.substring(9,10);
	//element.value = d.substring(0,8);
  	

    var g = element.substring(9,11);
	var f = element.substring(0,9);
	e = document.getElementById(f);
	if (e.style.display =='none')
	{
		e.style.display='block';
	}
	//alert(g);
	return (g);
}

function check_submit(){
	var comments = document.VOTE.comments.value;
	var counter = 0;
	var flag = 0;
	
	for (counter = 0; counter < 5; counter++)
		{
	  	if (eval("document.VOTE.rdbRate[" + counter + "].checked") == true)
	  		{
	  		document.VOTE.rating.value = (eval("document.VOTE.rdbRate[" + counter + "].value"));
	  		flag = 1
	  		}
	  	} 
	if (flag == 0) 
	{
	  	alert("The following information was missing or not valid:\n\n Select a rating from 1 to 5" );
	  	return false;
	}
	  	
	
	if(document.VOTE.comments.value.length > 300)
	{
        alert("Your response must be less than 300 characters.");
        document.VOTE.comments.focus();
        return false;
	}
    else
	{
        VOTE.submit();	
        return true;
	}
}

function show_language(element)
{
  	var e = document.getElementById(element);	
	document.getElementById("language_area").innerHTML = e.innerHTML
	document.getElementById("english").style.display = "none";
}


function divControlClick(Div, Label, Image)
{
    var myDiv = document.getElementById(Div);    
    var myLabel = document.getElementById(Label);
    var myImage = document.getElementById(Image);
    
    if (myDiv.style.display == "")
    {
        myDiv.style.display = "none";
        myLabel.innerHTML = "Show Detail";
        myImage.src = "/wwimages/script/expand_show.gif";        
    }
    else
    {
        myDiv.style.display = "";
        myLabel.innerHTML = "Hide Detail";
        myImage.src = "/wwimages/script/collapse_hide.gif";
    }
}

function divControlClickSCN(Div, Label, Image)
{
    var myDiv = document.getElementById(Div);    
    var myLabel = document.getElementById(Label);
    var myImage = document.getElementById(Image);
    
    if (myDiv.style.display == "")
    {
        myDiv.style.display = "none";
        myLabel.innerHTML = "&#26174;&#31034;&#32454;&#33410;";
        myImage.src = "/wwimages/script/expand_show.gif";        
    }
    else
    {
        myDiv.style.display = "";
        myLabel.innerHTML = "&#38544;&#34255;&#32454;&#33410;";
        myImage.src = "/wwimages/script/collapse_hide.gif";
    }
}

function divControlClickTCN(Div, Label, Image)
{
    var myDiv = document.getElementById(Div);    
    var myLabel = document.getElementById(Label);
    var myImage = document.getElementById(Image);
    
    if (myDiv.style.display == "")
    {
        myDiv.style.display = "none";
        myLabel.innerHTML = "&#39023;&#31034;&#32048;&#31680;";
        myImage.src = "/wwimages/script/expand_show.gif";        
    }
    else
    {
        myDiv.style.display = "";
        myLabel.innerHTML = "&#38577;&#34255;&#32048;&#31680;";
        myImage.src = "/wwimages/script/collapse_hide.gif";
    }
}

 function divShowHide(element)
{
    var myPanel = document.getElementById(element);
    
    if (myPanel.style.display == "none")
    {
        myPanel.style.display = "block";
    }
    else
    {
        myPanel.style.display = "none";
    }
}
function supporturlreturn()
{
var url_return="";
{
url_return="http://support.creative.com/kb/ShowArticle.aspx?sid=";
}
return url_return;
}

function check_product_id(element) {

	var productid = element;
	if (productid != null) {
		if (productid.match(18615)) {
			//ZEN MX
			window.open(cgiurl+',case=60849')
		}
		else if (productid.match(117) || productid.match(9019) || productid.match(4836) || productid.match(9288) || productid.match(10274)) {
			//All Archived ZEN Players	
			window.open(cgiurl+',case=64212')
		}
		else if (productid.match(14179) || productid.match(14107) || productid.match(10795)) {
			//ZEN Micro
			window.open(cgiurl+',case=64161')	
		}
		else if (productid.match(11519)) {
			//ZEN 20GB
			window.open(cgiurl+',case=64119')	
		}
		else if (productid.match(13599) || productid.match(14259)) {
			//ZEN Sleek
			window.open(cgiurl+',case=64128')	
		}
		else if (productid.match(15283) || productid.match(15306) || productid.match(17253)) {
			//ZEN V
			window.open(cgiurl+',case=64069')	
		}
		else if (productid.match(12985) || productid.match(15752)) {
			//ZEN Vision
			window.open(cgiurl+',case=64109')	
		}
		else if (productid.match(16002) || productid.match(15986)) {
			//ZEN Vision:M
			window.open(cgiurl+',case=64088')	
		}
		else if (productid.match(16708)) {
			//ZEN Wav
			window.open(cgiurl+',case=64185')	
		}
		else if (productid.match(16999) || productid.match(17108)) {
			//ZEN Cobra
			window.open(cgiurl+',case=64185')	
		}
		else if (productid.match(17810) || productid.match(17811)) {
			//ZEN Xfi
			window.open(cgiurl+',case=63024')	
		}
		else if (productid.match(17897)) {
			//ZEN Mozaic
			window.open(cgiurl+',case=64004')	
		}
		else if (productid.match(18430) || productid.match(18431)) {
			//ZEN Mozaic 300
			window.open(cgiurl+',case=63826')	
		}
		else
			alert("Under Construction");
	}
	else
		alert("Product ID is invalid");
}