﻿<!-- #include file=../script/aspfunc.asp-->
<!--
//check event function(mouse click)
function right(e) {
if (navigator.appName == 'Netscape' && 
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' && 
(event.button == 2 || event.button == 3)) {
//alert("Welcome to Hikosen Cara's website");
return true;
}
return true;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;

//open new window function
function getDay(where)
{
	if (where=='eta')
	{
		window.open ('calendar.htm?PutTo=eta',null,'fullscreen=0,channelmode=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=250,height=180,top='+(screen.height-180)/2 +',left='+(screen.width-250)/2 +'');
	}
}
function viewproduct(no)
{
	window.open ('viewproduct.asp?no='+no,'_blank','fullscreen=0,channelmode=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,scroll=auto,resizable=no,width=500,maximize=false,height=350,top='+(screen.height-350)/2 +',left='+(screen.width-500)/2 +'');
	//window.showModalDialog('viewproduct.asp?no='+no,,'dialogWidth=259 ; dialogHeight=350');
}
function viewme(iidno)
{
	document.display.style.cursor=hand;
}
//make picture blur function
function makevisible(cur,which,level){
cur.style.cursor='hand';
if (which==0)
cur.filters.alpha.opacity=100
else
cur.filters.alpha.opacity=level
}
//check numberic function
function isNumber(str)
{
  var digits="0123456789."
  var temp
  if (str=="") 
  {
    return false
  }
  for (var i=0;i<str.length;i++)
  {
    temp=str.substring(i,i+1)
    if (digits.indexOf(temp)==-1)
    {
      return false
    }
  }
  return true
}
//true : is number
//else : false
function checknumber(field)
{
	if(!isNumber(field.value))
	{
		displayMessage(field,"In valid number ("+field.name +")");
		return false;
	}
	else return true;
}

//function to catch the enter key
function onKeyPress ()
 {
	var keycode;
	var el=event.srcElement
	if (el.tagName=="INPUT"&& el.type=="text")
	{
		if (window.event) 
			keycode = window.event.keyCode;
		else if (e) 
			keycode = e.which;
		else return true;
		if (keycode == 13) 
			{
				alert("please click on the Submit button to search this style");
				return false ;
			}
		return true;
	}//if 
}//function
document.onkeypress = onKeyPress;
//  End

//function to remove comma in a string
function removecomma(strMemo)
{
    var strTemp="";
    var strData;
    var npos;
    var strLength;
    var SearChar ;
	searChar = ",";
    strData = strMemo.toString();
    strLength = searChar.length;
    npos = strData.indexOf(searChar);
    do 
    {
        strTemp = strTemp + strData.substring(0,npos);
        strData = strData.substring(npos+1,strData.length);
        npos = strData.indexOf(searChar);
    }
    while (npos > 0)
    return  strTemp + strData ;
}
//funtion to make image transaction
var vTrans;
vTrans=0
function doTrans(el, elt, vc)
{
	if (document.all)
	{
		if (vTrans>=23)
		{
			vTrans=1
		}
		vTrans=vTrans+1
		document.getElementById(elt).filters.revealtrans.Transition=vTrans;
		if (vc==0)//mouse over
		{
			document.getElementById(elt).src=document.getElementById(el).src;
		}
		else
		{
			document.getElementById(elt).src=document.getElementById(elt).src;
		}
		document.getElementById(elt).filters.item(0).Apply();
		document.getElementById(elt).filters.item(0).Play();
	}
}

//function check image file
function checkFile(field)
{
var strfile=field.value.toLowerCase();
var index = strfile.indexOf(".");
var ext=strfile.substring(index+1,strfile.length+1);
if (ext=="gif" || ext=="jpg" || ext=="jpe" || ext=="jpeg" || ext=="swf" || ext=="bmp"|| ext=="tif")
	{
		return true;
	}
else
 	{
		displayMessage(field,"In valid image file ("+field.value +")");
		
		return false;
	}
    
}
//get current day
function getDay()
{
 month = new Array(12);
 day = new Array(7);
//var TheForm = document.forms[0];
 
 month[0]="1";
 month[1]="2";
 month[2]="3";
 month[3]="4"; 
 month[4]="5";
 month[5]="6";
 month[6]="7";
 month[7]="8"; 
 month[8]="9";
 month[9]="10"
 month[10]="11";
 month[11]="12";
 day[0]="Sunday";
 day[1]="Monday";
 day[2]="Tuesday";
 day[3]="Wednesday";
 day[4]="Thursday";
 day[5]="Friday";
 day[6]="Saturday";
 today  = new Date();
 aDay   = today.getDay();
 aMonth = today.getMonth();
 aYear = today.getYear();
 aDate  = today.getDate();
 strDate = month[aMonth] + "/" + aDate +"/" + aYear
 return strDate;
}

//get current time 
function getTime()
{
 today  = new Date();
 h = today.getHours();
 m = today.getMinutes();  
 s = today.getSeconds();
 strDate =h +":"+ m +":"+ s ; 
 if (h >= 12) 
 {
   strDate = strDate + " P.M."
 }
 else
 {
   strDate = strDate + " A.M."
 }
 return strDate;
}
//get current time and day
function getTimeDay()
{
 month = new Array(12);
 day = new Array(7);
 month[0]="1";
 month[1]="2";
 month[2]="3";
 month[3]="4"; 
 month[4]="5";
 month[5]="6";
 month[6]="7";
 month[7]="8"; 
 month[8]="9";
 month[9]="10"
 month[10]="11";
 month[11]="12";
 day[0]="Sunday";
 day[1]="Monday";
 day[2]="Tuesday";
 day[3]="Wednesday";
 day[4]="Thursday";
 day[5]="Friday";
 day[6]="Saturday";
 today  = new Date();
 aDay   = today.getDay();
 aMonth = today.getMonth();
 aYear = today.getYear();
 aDate  = today.getDate();
 strDate = month[aMonth] + "/" + aDate +"/" + aYear
 h = today.getHours();
 m = today.getMinutes();  
 s = today.getSeconds();
 strDate =h +":"+ m +":"+ s ; 
 if (h >= 12) 
 {
   strDate = strDate + " P.M."
 }
 else
 {
   strDate = strDate + " A.M."
 }
 strDate = strDate + month[aMonth] + "/" + aDate +"/" + aYear
 return strDate;
}
// live clock
var timerID = null;
var timerRunning = false;
function stopclock (){
	if(timerRunning)
	clearTimeout(timerID);
	timerRunning = false;
}
function showtime (field) 
{
	var now = new Date();
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds()
	var timeValue = "" + ((hours >12) ? hours -12 :hours)
	timeValue += ((minutes < 10) ? ":0" : ":") + minutes
	timeValue += ((seconds < 10) ? ":0" : ":") + seconds
	timeValue += (hours >= 12) ? " chiều " : " sáng "
	field.value=timeValue;
//	timerID = setTimeout("showtime("+field+")",1000);
	timerRunning = true;
}
function startclock(field)
{
	stopclock();
	showtime(field);
}
//cutting space
function spacecutting(st){
	st=''+st;
	s=st.split("");
	var space=0;
	var ch='';
     for(i=0;i<s.length;i++){
          if (s[i]==' ') space++;
          else 
		  	  if ((space>0)&&(ch=='')){
			     ch+=s[i].toUpperCase();	
                 space=0;
              }
              else 
			  	  if ((space>0)&&(ch!='')) {
				     ch+=' '+s[i].toUpperCase();
                     space=0;
	   		      }
				  else  if (ch=='') ch+=s[i].toUpperCase();	
                  		else ch+=s[i].toLowerCase();
    }
return ch; 
}
//return true:empty
//else return false
function checkempty(field) 
{
	if(spacecutting(field.value)=="")
	{
		displayMessage(field,"Please input data here ("+field.name +")");
		return true;
	}
	else return false;
}
//return true:empty
//else return false
function checkemptyWithoutMess(field) 
{
	if(spacecutting(field.value)=="")
		return true;
	else 
		return false;
}
//return true:equal
//else return false
function checkEqual(field,des,mess) 
{
	if(field.value==des)
		{
		displayMessage(field,mess+"("+field.name +")");
		return true;
		}
	else 
		return false;
}
function displayMessage(form,message) 
{

	var objForm = form;
	if (objForm.name==form.name)  
	{ 
		alert(message);
		objForm.focus();
	}
}

//function check html file
function checkHtmlFile(field)
{
var strfile=field.value.toLowerCase();
var index = strfile.indexOf(".");
var ext=strfile.substring(index+1,strfile.length+1);
if (ext=="htm" || ext=="html")
	{
		return true;
	}
else
 	{
		displayMessage(field,"In valid htm (html) file ("+field.value +")");
		
		return false;
	}
    
}
//function check Access file
function checkExcelFile(field)
{
var strfile=field.value.toLowerCase();
var index = strfile.indexOf(".");
var ext=strfile.substring(index+1,strfile.length+1);
if (ext=="xls")
	{
		return true;
	}
else
 	{
		displayMessage(field,"In valid Microsoft Excel file (*.xls)--("+field.value +")");
		
		return false;
	}
    
}

-->