function doRate(event_id,value)
{
	if(value>0 && value<6)
		load_info('../review/rate_save.php?event_id='+event_id+'&rate_value='+value,'result');
}
function showCalendar(id)
{
	var date = showModalDialog("../javascript/popup_calendar.htm", "", "help: no; status: no; scroll: no;");
	if (date)
	{
		eval(id).value=date;
	}
}
function saveFile(id,filename)
{
  if (!document.all)
  {
    alert("Xin lo^~i, tri`nh duye^.t web cu?a ba.n kho^ng cho phe'p thu+.c hie^.n thao ta'c na`y...");
    return;
  }
  var win = open("../product/product_viewsave.php?product_id="+id, "", "scrollbars,width=500,height=300");
  win.document.execCommand("SaveAs", null, filename);
  win.close();
}
function alertIt()
{
	var browser_type=navigator.appName
	var browser_version=navigator.appVersion
	bVer=browser_version.split(";");
	b=bVer[1].split(" ");
	v=parseFloat(b[2]);
	if (browser_type!="Microsoft Internet Explorer"||v<5.5)
		alert("Vui long su dung trinh duyet Internet Explorer - Phien ban 5.5 tro len!");
}
function doContact()
{
	checkTextField(document.tf.name.value,"Vui long nhap ten");
	checkTextField(document.tf.address.value,"Vui long nhap dia chi");
	checkTextField(document.tf.note.value,"Vui long nhap noi dung lien he");
	checkEmail(document.tf.email.value,"Vui long kiem tra Email");
	if(checkAll())
		document.tf.submit();
}
function doVideo()
{
	document.getElementById('video').innerHTML='<embed allowfullscreen="true" src="../includes/flvplayer.swf?autostart=false&thumbsinplaylist=true&overstretch=true&showdigits=true&showfsbutton=true&repeat=false&backcolor=0x86C630" width="240" height="180"></embed>';
}
var ss_id=0;
function openW(file,id)
{
 	if(ss_id!=id || document.getElementById('ss').innerHTML=='')
 	{
		ss_id=id;
		document.getElementById('ss').innerHTML='';
		document.getElementById('ss').style.width='600px';
		document.getElementById('ss').style.top=getScrY();
		document.getElementById('ss').style.visibility='visible';	
		toggle_info(file,"ss");
	}
	else		
	{ 		
		document.getElementById('ss').innerHTML='';
		document.getElementById('ss').style.width='0px';
		document.getElementById('ss').style.visibility='hidden';
 	} 	
 	
 	//if(document.getElementById('ss').innerHTML=='')
 	//	document.getElementById('ss').style.width='0px';
 	//else	
}
var idDIV="imgPopup";
function image_open(text,i)
{ 
	hideDIV(idDIV);
	w = 200;                     
	bgColor = "#FFFFC0";             
	border = "1px dotted #ff0000";   
	var img2=new Image();
	img2.src=text;	
	s = (border ? 'border:' + border + '; ' : '');
	t='<div title="Click to close" onclick="hideDIV(\''+idDIV+'\')" ' + (s ? ' style="' + s + ';padding:2px"' : '') + '>';
	t+='<img src='+text+'></div>';	
	
	left=((parseInt(getWinX())- parseInt(img2.width))/2)+parseInt(getScrX());
	top1=((parseInt(getWinY())- parseInt(img2.height))/2)+parseInt(getScrY());
	document.getElementById(idDIV).style.left = left;
	document.getElementById(idDIV).style.top = top1;
	document.getElementById(idDIV).innerHTML= t;
	document.getElementById(idDIV).style.backgroundColor = bgColor;
	document.getElementById(idDIV).style.visibility = 'visible';
}
function hideDIV(id)
{
   document.getElementById(id).style.visibility = 'hidden';	
}
function getScrX() {
  var offset = 0;
  if(window.pageXOffset)
    offset = window.pageXOffset;
  else if(document.documentElement && document.documentElement.scrollLeft)
    offset = document.documentElement.scrollLeft;
  else if(document.body && document.body.scrollLeft)
    offset = document.body.scrollLeft;
  return offset;
}
function getScrY() {
  var offset = 0;
  if(window.pageYOffset)
    offset = window.pageYOffset;
  else if(document.documentElement && document.documentElement.scrollTop)
    offset = document.documentElement.scrollTop;
  else if(document.body && document.body.scrollTop)
    offset = document.body.scrollTop;
  return offset;
}
function getWinX() {
  var size = 0;
  if(window.innerWidth)
    size = window.innerWidth;
  else if(document.documentElement && document.documentElement.clientWidth)
    size = document.documentElement.clientWidth;
  else if(document.body && document.body.clientWidth)
    size = document.body.clientWidth;
  else size = screen.width;
  return size;
}
function getWinY() {
  var size = 0;
  if(window.innerHeight)
    size = window.innerHeight;
  else if(document.documentElement && document.documentElement.clientHeight)
    size = document.documentElement.clientHeight;
  else if(document.body && document.body.clientHeight)
    size = document.body.clientHeight;
  else size = screen.height;
  return size;
}
document.write('<div id="'+idDIV+'" style="position:absolute; visibility:hidden"></div>');