function ValidateEmail(myformobject)
{
return emailCheck(myformobject);
}







function emailCheck (emailStr) {
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
	alert("Email address seems incorrect (check @ and .'s)")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    alert("The username doesn't seem to be valid.")
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Destination IP address is invalid!")
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("The domain name doesn't seem to be valid.")
    return false
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   alert("The address must end in a three-letter domain, or two letter country.")
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This address is missing a hostname!"
   alert(errStr)
   return false
}

// If we've gotten this far, everything's valid!
return true;
}











function  submitSearch()
{
if (document.search.key.value !="")
{
document.search.submit();
}
}


function updateshipping()
{
document.form1.action="order.php";
document.form1.submit();
}


function getmessage()
{
day = new Date()
hr = day.getHours()
if (hr == 1)
return ("Good morning!   1AM and you are still going! ")
if (hr == 2)
return ("Hey, it's past  2AM!   The bars must be closed!")
if (hr == 3)
return ("Hey, it's after  3AM!   Are you a vampire or what?")
if (hr == 4)
return ("4AM?  You must roam all night huh!")
if (hr == 5)
return ("Whoa! It's almost daylight and you are still going!")
if (hr == 6)
return ("Hey, isn't it way too early to be using your computer?")
if ((hr == 7) || (hr == 8) || (hr == 9) || (hr == 10))
return ("Good Morning!")
if (hr == 11)
return ("11AM...What are you doing surfing JavaScript pages so early??")
if (hr == 12)
return ("NOON!  Great, it must be time for me to eat breakfast!")
if (hr == 14)
return ("It's 2PM. Have you eaten lunch yet??")
if ((hr == 13) || (hr == 15) || (hr == 16))
return ("Good Afternoon!")
if ((hr == 17) || (hr == 18) || (hr == 19) || (hr == 20) || (hr == 21) || (hr == 22))
return ("Good Evening! Welcome to prime time on the web!")
if (hr == 23)
return ("It's almost midnight...Aren't you sleepy yet?")
if (hr == 0)
return ("It's midnight... do you ever sleep?")
}




function jsredirect(mypage)
{
document.location=mypage;
}


if (document.images) {
btnFurniture = new Image();
btnFurniture.src = "/images/mainnav/btnFurniture.gif";
btnLighting= new Image();
btnLighting.src = "/images/mainnav/btnLighting.gif";

btnSystems= new Image();
btnSystems.src = "/images/mainnav/btnSystems.gif";
btnAccessories= new Image();
btnAccessories.src = "/images/mainnav/btnAccessories.gif";
btnKitchens= new Image();
btnKitchens.src = "/images/mainnav/btnKitchens.gif";
btnBath= new Image();
btnBath.src = "/images/mainnav/btnBath.gif";
btnDesignServices= new Image();
btnDesignServices.src = "/images/mainnav/btnDesignServices.gif";
btnIndoorSelected= new Image();
btnIndoorSelected.src = "/images/mainnav2/btnIndoorSelected.gif";
btnOutdoor= new Image();
btnOutdoor.src = "/images/mainnav2/btnOutdoor.gif";
btnOutdoorSelected= new Image();
btnOutdoorSelected.src = "/images/mainnav2/btnOutdoorSelected.gif";
btnIndoor= new Image();
btnIndoor.src = "/images/mainnav2/btnIndoor.gif";
consultationon= new Image();
consultationon.src = "/images/mainnav3/consultationon.gif";
planningon= new Image();
planningon.src = "/images/mainnav3/planningon.gif";
designon= new Image();
designon.src = "/images/mainnav3/designon.gif";
resourceson= new Image();
resourceson.src = "/images/mainnav3/resourceson.gif";
rentalson= new Image();
rentalson.src = "/images/mainnav3/rentalson.gif";
educationon= new Image();
educationon.src = "/images/mainnav3/educationon.gif";
consultationoff= new Image();
consultationoff.src = "/images/mainnav3/consultationoff.gif";
planningoff= new Image();
planningoff.src = "/images/mainnav3/planningoff.gif";
designoff= new Image();
designoff.src = "/images/mainnav3/designoff.gif";
rentalsoff= new Image();
rentalsoff.src = "/images/mainnav3/rentalsoff.gif";
educationoff= new Image();
educationoff.src = "/images/mainnav3/educationoff.gif";
 

}

function imageon(imgName){
        if (document.images) {
    document[imgName].src = eval(imgName + 'on.src')
}}

function imageoff(imgName){
        if (document.images) {
    document[imgName].src = eval(imgName + 'off.src')
}}

function previewimage(file)
{
page2preview="/php/previewimage.php?id="+ file;
var iMyWidth;
var iMyHeight;
//half the screen width minus half the new window width (plus 5 pixel borders).
iMyWidth = (window.screen.width/2) - (75 + 10);
//half the screen height minus half the new window height (plus title and status bars).
iMyHeight = (window.screen.height/2) - (100 + 50);
//Open the window.
window.open (page2preview, "preview", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width=242,height=242,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight );
}


function previewimage2(file, width, height)
{
page2preview="/php/previewimage.php?id="+ file;
var iMyWidth;
var iMyHeight;
//half the screen width minus half the new window width (plus 5 pixel borders).
iMyWidth = (window.screen.width/2) - (75 + 10);
//half the screen height minus half the new window height (plus title and status bars).
iMyHeight = (window.screen.height/2) - (100 + 50);
//Open the window.
window.open (page2preview, "preview", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width="+ width +",height=" + height +",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight );
}

function previewimage3(file, width, height)
{
page2preview="/php/previewimage3.php?id="+ file;
var iMyWidth;
var iMyHeight;
//half the screen width minus half the new window width (plus 5 pixel borders).
iMyWidth = (window.screen.width/2) - (75 + 10);
//half the screen height minus half the new window height (plus title and status bars).
iMyHeight = (window.screen.height/2) - (100 + 50);
//Open the window.
window.open (page2preview, "preview", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width="+ width +",height=" + height +",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight );
}

function previewimage4(file, width, height)
{
page2preview="/php/previewimage4.php?id="+ file;
var iMyWidth;
var iMyHeight;
//half the screen width minus half the new window width (plus 5 pixel borders).
iMyWidth = (window.screen.width/2) - (75 + 10);
//half the screen height minus half the new window height (plus title and status bars).
iMyHeight = (window.screen.height/2) - (100 + 50);
//Open the window.
window.open (page2preview, "preview", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width="+ width +",height=" + height +",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight );
}

function sendpage(id, mytitle)
{
page2preview="/sendpage.php?id="+ id+"&mytitle="+mytitle;
window.open (page2preview, "SendPage", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width=300,height=340");
}

function viewcertificate()
{
page2preview="https://smarticon.geotrust.com/smarticonprofile?Referer=http://www.orangeskin.com";
window.open (page2preview, "SSL", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width=360,height=450");
}


function inquire(id, prodname)
{
page2preview="/inquire.php?id="+ id+"&pname="+prodname;
window.open (page2preview, "inquirePage", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width=300,height=265");
}


 

