/*
function hidestatus(){
window.status='Welcome to Da Nang Securites Company [www.dnsc.com.vn]'
return true
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover=hidestatus
document.onmouseout=hidestatus



document.oncontextmenu=function()
{
	return false
}

if(document.layers)
{
	window.captureEvents(Event.MOUSEDOWN);
	window.onmousedown=function(e)
	{
		if(e.target==document)return false;
	}
}
else
{
	document.onmousedown=function()
	{
		return false
	}
}
*/
function compare_submit()
{
	document.getElementById("myform").submit()
}

function search_submit()
{
	  document.frmSearch.submit();
}

function rollon(a) 
{
	a.style.backgroundColor='#F0F8FF';
}	
function rolloff(a)
{
	a.style.backgroundColor='';
}

function exp_res(div_id)
{
	if(document.getElementById(div_id).style.display == "inline")
	{ 	
		document.getElementById(div_id).style.display = "none"; 
	}
	else
	{ 
		document.getElementById(div_id).style.display = "inline";
	}
}

function exp_res_img(div_id,img_name)
{
	
	var btn_max = new Image();
	btn_max.src = "images/folder_off.jpg";
	var btn_min = new Image();
	btn_min.src = "images/folder_on.jpg";
	
	if(div_id.style.display == "inline")
	{ 	
		div_id.style.display = "none"; 
		if(img_name.src == btn_min.src) img_name.src = btn_max.src;
		else img_name.src = btn_min.src;
	}
	else
	{ 
		div_id.style.display = "inline";
		if(img_name.src== btn_min.src) img_name.src = btn_max.src;
		else img_name.src = btn_min.src;
	};
}


function brand_jump(code,cat)
{
	if (code != "")
	{
		window.location='./?mdl=product&cat='+cat+'&brand='+code;
	}
	else return false;
}

function menu_jump(url)
{
	if (url != "")
	{
		window.location=url;
	}
	else return false;
}
function menu_gourl(url)
{
	if (url != "")
	{
		window.location=url;
	}
	else return false;
}
function menu_submit(data,form)
{
	if (data != "")
	{ 
		form.action=document.URL;
		form.submit();
	}
	else return false;
}
function ask(url,msg)
{
	if (!confirm(msg))
	{ //do nothing
		return false;
	}
	else 
	{window.location = url}
}

function popup(url,width,height) 
{
	OpenWin = this.open(url, "toolbar=no,menubar=no,location=no,scrollbars=no,status=no,resize=no,resizable=yes,width="+width+",height="+height+",top=100,left=100'");
}

function popup_status(url,width,height) 
{
	OpenWin = this.open(url,"_blank", "toolbar=no,menubar=no,location=no,scrollbars=no,status=yes,resize=no,resizable=yes,width="+width+",height="+height+",top=100,left=100'");
}

function changeclass(id, newclass)
{
	document.getElementById(id).className = newclass;
}

function e(string)
{
	document.writeln(string);
}

function show_flash(url,w,h,wmode)
{
	e('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + w + '" height="' + h + '">');
	e('<param name="movie" value="' + url + '" />');
	e('<param name="quality" value="high" />');
	e('<param name="wmode" value="' + wmode + '" />');
	e('<embed src="' + url + '" wmode="' + wmode + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + w + '" height="' + h + '"></embed>');
	e('</object>');
}

function add_to_favi(id,user) 
{
	parent.frame_cart_quan.location.href="add_to_favi.php?mode=quantity&id=" + id + "&user=" + user
	/*parent.frame_cart_cost.location.href="add_to_cart.php?mode=cost&id=" + id;*/
	return false;
}

function add_to_cart(id) 
{
	parent.frame_cart_quan.location.href="add_to_cart.php?mode=quantity&id=" + id
	/*parent.frame_cart_cost.location.href="add_to_cart.php?mode=cost&id=" + id;*/
	return false;
}

function open_enlarge(div)
{
	document.getElementById(div).style.display = 'inline';
	ht = document.getElementsByTagName("html");
	ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
}

function close_enlarge(div)
{
	document.getElementById(div).style.display = 'none';
	ht[0].style.filter = "";
}

function show_enlarge_photo(url)
{
	e('<div id="item_photo"  class="div_enlarge" style="display:none">');
	e('<table border="0" cellspacing="0" cellpadding="0" >');
	  e('<tr>');
		e('<td width="1"><img src="images/frame/border_top_left.gif" width="9" height="9" /></td>');
		e('<td background="images/frame/top_bg.gif"></td>');
		e('<td width="1"><img src="images/frame/border_top_right.gif" width="11" height="9" /></td>');
	  e('</tr>');
	  e('<tr>');
		e('<td background="images/frame/left_bg.gif"></td>');
		e('<td bgcolor="#FFFFFF">');
			e('<div align="left"><a href="#" style="color:#666666" onclick="close_enlarge(\'item_photo\'); return false;"><img src="images/icon_close.gif" width="16" height="14" alt="Close this window" /> Close</a></div>');
			e('<div class="enlarge_photo" align="center"><img src="'+ url + '" /></div>');
		e('</td>');
		e('<td background="images/frame/right_bg.gif"></td>');
	 e(' </tr>');
	 e(' <tr>');
		e('<td><img src="images/frame/border_bottom_left.gif" width="9" height="11" /></td>');
		e('<td background="images/frame/bottom_bg.gif"></td>');
		e('<td><img src="images/frame/border_bottom_right.gif" width="11" height="11" /></td>');
	  e('</tr>');
	e('</table>');
	e('</div>');
}


/*************************update 1/7/2008 by Le Minh Danh************************/
//Check field value of form when user submit
//param from : form need check
//size   	: number of form field 
//mess	: message that will be shown when error apear	
//return : true or false
function CheckSubmit(form, size, mess)
{

	for(i=0; i<size; i++)
	{
		if(form.elements[i].value == '')
		{
			alert(mess);
			return false;
		}
	}
	return true;
}


function gotourl(link)
{
	if(link!=0)
	{
		window.open(link, 'newwindow');
	}
}