﻿var fBrw=(navigator.userAgent.indexOf('MSIE')!= -1 && navigator.userAgent.indexOf('Windows')!= -1);
var _d=document
function gmobj(mtxt){if(_d.getElementById){m=_d.getElementById(mtxt)}else if(_d.all){m=_d.all[mtxt]}else if(_d.layers){m=_d[mtxt]}return m;}
function gmstyle(mtxt){m=gmobj(mtxt);if(!ns4){if(m)m=m.style;}return m;}
function spos(gm,t_,l_,h_,w_){px="px";if(ns4){px="";gms=gm;if(w_!=null)gms.clip.width=w_;if(h_!=null)gms.clip.height=h_;}else if(opra){px="";gms=gm.style;if(w_!=null)gms.pixelWidth=w_;if(h_!=null)gms.pixelHeight=h_}else{gms=gm.style;if(w_!=null)gms.width=w_+px;if(h_!=null)gms.height=h_+px;}if(t_!=null)gms.top=t_+px;if(l_!=null)gms.left=l_+px}
function gpos(gm){if(ns4){t_=gm.top;l_=gm.left;h_=gm.clip.height;w_=gm.clip.width;}else if(opra){t_=gm.offsetTop;l_=gm.offsetLeft;h_=gm.offsetHeight;w_=gm.offsetWidth;}else if(ns6){t_=gm.offsetTop;l_=gm.offsetLeft;h_=gm.offsetHeight;w_=gm.offsetWidth}else{if(mac){topM=gm.offsetParent.topMargin;if(!topM)topM=0;leftM=gm.offsetParent.leftMargin;if(!leftM)leftM=0;t_=parseInt(topM)+gm.offsetTop;l_=parseInt(leftM)+gm.offsetLeft;}else{t_=gm.offsetTop;l_=gm.offsetLeft;}h_=gm.offsetHeight;w_=gm.offsetWidth;}if(konq){w_=parseInt(gm.style.width);h_=parseInt(gm.style.height);}var gpa=new Array();gpa[0]=t_;gpa[1]=l_;gpa[2]=h_;gpa[3]=w_;return(gpa)}
//================================================================================================================
function ql(cbo)
{
	if (cbo.value=='home')		document.location='default.aspx';
	if (cbo.value=='price')		document.location='price.aspx';
	if (cbo.value=='contact')	document.location='contact.aspx';
}
//================================================================================================================
function c(url,t)
{
	document.anchors.target	= t; 
	document.location		= url;
}

//================================================================================================================
function ChangeArrow(id,f)
{
	var o=document.getElementById(id);
	//alert(o.src +"\n"+ id);
	if (f)
	{
		//alert('arrow2');
		o.src='images/arrow2.gif';
	}
	else
	{
		//alert('arrow1');
		o.src='images/arrow1.gif';
	}
}
//================================================================================================================

//================================================================================================================
function CheckAll(State)
{
	for (var i=0; i < document.frmSubmit.elements.length; i++)
	{
		document.frmSubmit.elements[i].checked=State;
	}
}
//================================================================================================================
function ReadyToDelete()
{
	for (var i=0; i < document.frmSubmit.elements.length; i++)	
		if (document.frmSubmit.elements[i].type=="checkbox" 
		&& document.frmSubmit.elements[i].checked)
			return true;
	
	return false;		
}
//================================================================================================================
function RemoveItem()
{
	var strRemoveList='';

	for (var i=0; i < document.frmSubmit.elements.length; i++)
	{
		if (document.frmSubmit.elements[i].type=="checkbox" 
		&& document.frmSubmit.elements[i].checked
		&& document.frmSubmit.elements[i].name.substr(0,3)=="chk")
		{
				// only available for col with char type and primary key
				strRemoveList+=","+ document.frmSubmit.elements[i].id+"";
				//alert(strRemoveList);
		}
	}

	if (strRemoveList=='')
	{
		alert('please check to checkbox in which record you want to delete !!!');
		return;
	}

	strRemoveList=strRemoveList.substring(1);
	strRemoveList='('+strRemoveList+')';

	if (confirm('delete checked item ?'))
	{		
		//alert(strRemoveList)
		document.frmSubmit.txtAction.value='delete';		
		document.frmSubmit.txtDelete.value = strRemoveList;
		document.frmSubmit.submit();
	}
}
//================================================================================================================
function WriteFooter(LeftMenuOffsetY)
{
	
	var vTemp=document.getElementById('table_detail').offsetHeight-3;
	var g_top=0;//(g_fixheight)+(20)+(LeftMenuOffsetY);
	if (vTemp>600)
	{
		g_fixheight=vTemp
		g_top=g_fixheight+20+LeftMenuOffsetY;
	}	
	else
	{
		g_fixheight=600;
		g_top=g_fixheight+20+LeftMenuOffsetY;
	}
	//alert('g_fixheight='+g_fixheight);	
	//alert('g_top='+g_top);
	document.write ('	<div id="CopyrightDiv" name="CopyrightDiv" style="Z-INDEX:999;position:absolute;left:0;top:'+g_top+';width:778;height:33;visibility:visible;">');
	document.write ('			<TABLE WIDTH="778" BORDER="0" CELLPADDING="0" CELLSPACING="0">');
	document.write ('			<tr>');
	document.write ('				<td width="100%" height=33 background="images/bg_bottom_banner.gif" class="Copyright" align=center>');
	document.write ('					Copyright © TAN 2004 www.hoanghamobile.com, All rights reserved');
	document.write ('				</td>');
	document.write ('			</tr>');	
	document.write ('		</table>');
	document.write ('		</div>');	
}
//================================================================================================================
//var fBrw=(navigator.userAgent.indexOf('MSIE')!= -1 && navigator.userAgent.indexOf('Windows')!= -1);
function openImage(vLink, vHeight, vWidth)
{
	var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;

	if (sLink == '')
	{
		return false;
	}

	winDef = 'status=no,resizable=yes,scrollbars=yes,toolbar=no,location=no,fullscreen=yes,titlebar=yes,height='.concat(vHeight).concat(',').concat('width=').concat(vWidth).concat(',');
	winDef = winDef.concat('top=0').concat(',');
	winDef = winDef.concat('left=0');
	newwin = open('', '_blank', winDef);
	newwin.document.writeln('<link rel="stylesheet" type="text/css" href="hiway.css">');
	newwin.document.writeln('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">');
	newwin.document.writeln('<center>');
	newwin.document.writeln('<a href="" onClick="window.close(); return false;"><img src="', sLink, '" alt="', (fBrw) ? '&#272;&#243;ng l&#7841;i' : 'Dong lai', '" border=0></a></b>');
	newwin.document.writeln('</center>');
	newwin.document.writeln('</body>');
	

	if (typeof(vLink.href) != 'undefined')
	{
		return false;
	}
}
//================================================================================================================
function ShowUpload()
{
	winDef = 'status=no,resizable=no,scrollbars=no,toolbar=no,location=no,fullscreen=no,titlebar=yes,height=20;width=350;top=300;left=0';
	newwin = open('', '_blank', winDef);
	newwin.document.writeln('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">');
	newwin.document.writeln('<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="UploadFile.asp">');
	newwin.document.writeln('<table width=100% height=100% border=0><tr><td align=center valign=middle>');
	newwin.document.writeln('<INPUT TYPE=FILE SIZE=50 NAME="FILE1">');
	newwin.document.writeln('<INPUT TYPE=SUBMIT VALUE="Upload!">');	
	newwin.document.writeln('</td></tr></table>');
	newwin.document.writeln('</FORM>');
	newwin.document.writeln('</body>');
}
