function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function SendDataToFlashMovie()
{
	var flashMovie=getFlashMovieObject("header_inside");
	flashMovie.SetVariable("/:menu.username", unescape(GetCookie('username')));
}

function getCookieVal (offset) {  
var endstr = document.cookie.indexOf (";", offset);  
if (endstr == -1)    
endstr = document.cookie.length;  
return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) {    
var j = i + alen;    
if (document.cookie.substring(i, j) == arg)      
return getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) break;   
}  
return null;
}

function goSearch()
{
		var flashMovie=getFlashMovieObject("header_inside");
		var keyword=flashMovie.GetVariable("/:keyword");

		document.search.keyword.value=keyword;
		document.search.action = "/jsp/search_result.jsp";
		document.search.submit();
}

function getRadioValue(RadioName)
{
	var colRadio = document.getElementsByName(RadioName);
	for (var i = 0; i < colRadio.length; i++)
	{
		if (colRadio[i].checked)
		{
			return colRadio[i].value;
		}
	}
	return null;
}


function checkForm(theForm)
{
	if ((theForm.votenum[0].checked == false) && (theForm.votenum[1].checked == false) && (theForm.votenum[2].checked == false) && (theForm.votenum[3].checked == false) && (theForm.votenum[4].checked == false))
	{
		alert("沒有選擇評分！");
		theForm.votenum[0].focus();
		//return (false);
		return;
	}
	else{
		OpenWin("/jsp/ranking/ranking.jsp?id="+document.voteit.id.value+"&votenum="+getRadioValue("votenum"), '0', '0');
	}
}

function OpenWin(name,wwidth,wheight) {
	win=window.open(name,wwidth+wheight,"scrollbars=no,location=no,memubar=no,directories=no,toolbar=no,width="+wwidth+",height="+wheight+"");
}


function gotoCart(){
          document.forms[0].action="/jsp/order/order_step_01.jsp";
          document.forms[0].submit();
}

function zPrint(oTgt) {
	oTgt.focus(); 
         oTgt.print();
}
