// coded by turtles 2007
//
// http://www.turtle-media.com/
//
// all rights reserved
//
var root
//root = 'http://www.hong-kong-web-design.com/clients/communique/'
root = 'http://www.southchinacosmetics.com.hk/'
//
////////////////////////////////////////////////////////////////////
// get  and set cookie script
function getC(c_name){ 
if (document.cookie.length>0){c_start=document.cookie.indexOf(c_name + "=")
if (c_start!=-1){ c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start)
if (c_end==-1) {c_end=document.cookie.length}; return unescape(document.cookie.substring(c_start,c_end))}} return ""}
// setPermCookie script
function setC(c_name, c_value){document.cookie =  c_name + '=' + c_value + '; expires=Thu, 2 Aug 2040 20:47:11 UTC; path=/'}
////////////////////////////////////////////////////////////////////
//showhide
function show(divid){document.getElementById(divid).style.display = "block";}
function showinline(divid){document.getElementById(divid).style.display = "inline"}
function hide(divid){document.getElementById(divid).style.display = "none"}
////////////////////////////////////////////////////////////////////
function redirect(url){	document.location = url}
function conf(url){if(confirm("Are you sure?")){redirect(url)}}
////////////////////////////////////////////////////////////////////
function msg(loc) {
    if(confirm("Are you sure you want to delete?"))
    {
        location = loc;
    }
}
//////////////////////////////////////////////////////////////////////
/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true					
	}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
function ValidateSignup(){
	var cnameID=document.signUpfrm.cname
	var emailID=document.signUpfrm.email
	var addressID=document.signUpfrm.address
	var birthdayID=document.signUpfrm.birthday
			
	if ((cnameID.value==null)||(cnameID.value=="")){
		alert("Please enter your name")
		cnameID.focus()
		return false
	}
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your email address")
		var emailID=document.signUpfrm.email.focus()
		return false
	}
	
	if (echeck(emailID.value)==false){
		emailID.value=""
		var emailID=document.signUpfrm.email.focus()
		return false
	}
	
	if ((addressID.value==null)||(addressID.value=="")){
		alert("Please enter your mailing address")
		addressID.focus()
		return false
	}
	
	if ((birthdayID.value==null)||(birthdayID.value=="")){
		alert("Please enter your birthday month")
		birthdayID.focus()
		return false
	}

	
	return true	
	
	
}