var imgPath = "images/";
var loadedImages;


function preloadNavImages() {
	var myimages=new Array();
	function preloadimages(){
		for (i=0;i<preloadimages.arguments.length;i++){
			myimages[i]=new Image();
			myimages[i].src=preloadimages.arguments[i];
		}
	}


	//Enter path of images to be preloaded inside parenthesis. Extend list as desired.
	preloadimages("images/nav_2005.gif",
		"images/nav_spring_2006.gif",
		"images/nav_order_over.gif",
		"images/nav_about_over.gif",
		"images/nav_events_over.gif",
		"images/nav_bridal_over.gif",
		"images/nav_home_over.gif",
		"images/nav_signature.gif");
}

/* 
 * The rollover function requires that the image's ID be the same as the filename.  
 * The image's ID is then passed to the function as its argument.
 */

function turnOn(img, name, status) {
	image = img;
	image.src = imgPath + name + "_over.gif";
	window.status = status;
	return true;
	
}

function turnOff(img, name) {
	image = img;
	image.src = imgPath + name + ".gif";
	window.status = " ";
}

function changeStyle(path, styleImage, descImage, name) {
	//document.getElementById('moreStyles').style.visibility = "hidden";
	
	simage = document.getElementById(styleImage);
	simage.src = path + name + ".gif";
	dimage = document.getElementById(descImage);
	dimage.src = path + name + "_desc.gif";
	
	document.getElementById("styleNameHidden").value = name;
	
	//if ((name = "kelly1") || (name = "kelly2") || (name= "helene")) {
		//document.getElementById('moreStyles').style.visibility = "visible";
		
	//}
	//else
	//{		
		//document.getElementById('moreStyles').style.visibility = "hidden";
		
	//}
	
	return true;
	
}

function updateURL(image,collection,category) {

	styleImageName = document.getElementById(image).src;
			
	styleName = styleImageName.slice(styleImageName.lastIndexOf("/")+1, styleImageName.lastIndexOf("."));
	
	//if ((styleName = "kelly1") || (styleName = "kelly2") || (styleName= "helene")) {
		
		//document.getElementById('moreStyles').style.visibility = "visible";
	//}
	//else
	//{		
		//document.getElementById('moreStyles').style.visibility = "hidden";
	//}
	
	
	document.getElementById("styleNameHidden").value = styleName;
				
	document.getElementById("urlHidden").value = "larger_view.asp?style=" + styleName + "&category=" + category + "&collection=" + collection;
	return true;
}


function zoom(imageName) {
	var newwin = window.open("zoom.asp?style=" + imageName,"newwin","width=250,height=490");
	newwin.focus();
}

function necklacezoom(imageName) {
	var newwin = window.open("zoom.asp?style=" + imageName,"newwin","width=300,height=515");
	newwin.focus();
}

function viewSpecialOrderInfo() {
	var newwin = window.open("special_orders.asp","newwin","width=400,height=255");
	newwin.focus();
}
function viewMLPress() {
	var newwin = window.open("ML_Mag.html","newwin","width=700,height=1575,scrollbars=yes");
	newwin.focus();
}
function viewETPress() {
	var newwin = window.open("ET.html","newwin","width=825,height=1575,scrollbars=yes");
	newwin.focus();
}
function viewDMNPress() {
	var newwin = window.open("dmn.html","newwin","width=835,height=1000,scrollbars=yes");
	newwin.focus();
}
function viewReferFriendRules() {
	var newwin = window.open("refer_a_friend_rules.asp","newwin","width=400,height=275");
	newwin.focus();
}

function viewScarfStyles() {
	var newwin = window.open("scarf_styles.asp","newwin","width=500,height=350,scrollbars=yes");
	newwin.focus();
}

function seeRings() {
	var newwin = window.open("ring_lineup.asp","newwin","width=810,height=280");
	newwin.focus();
}


function validateUnsubscribeEmail(email) {
	if ( (email.indexOf(".") > 2) && (email.indexOf("@") > 0) ) {
		return true;
	} else {
		document.unsubscribeForm.errorMessage.value="Please enter a valid email address.";
		return false;
	}
}

function validateSubscribeEmail(email) {
	if ( (email.indexOf(".") > 2) && (email.indexOf("@") > 0) ) {
		return true;
	} else {
		document.subscribeForm.errorMessage.value="Please enter a valid email address.";
		return false;
	}
}

function validateNextjumpEmail(email) {
	if ( (email.indexOf(".") > 2) && (email.indexOf("@") > 0) ) {
		return true;
	} else {
		document.nextjumpForm.errorMessage.value="Please enter a valid email address.";
		return false;
	}
}

function addMore(newOrderNumber) {
	document.orderForm.addMore.value="true"; 
	document.orderForm.numOrderItems.value = newOrderNumber; 
	document.orderForm.submit();
}

function validateLoginForm() {
	passwd = document.loginForm.passwrd.value;
	if (passwd != "Admin3576")
	{
		document.loginForm.errorMessage.value="Invalid password.  Please enter your correct password (case-sensitive)."; 
	}
	else
	{	
		document.loginForm.isLoggedIn.value = "true";
	}
	document.loginForm.submit();
	
}


function validateArtiosOrderForm() {
	document.artiosOrderForm.errorMessage.value="";
	if ( (document.artiosOrderForm.email.value.indexOf(".") < 2) 
		|| (document.artiosOrderForm.email.value.indexOf("@") < 0) 
		|| (document.artiosOrderForm.firstName.value.length < 1)
		|| (document.artiosOrderForm.lastName.value.length < 1)
		|| (document.artiosOrderForm.address.value.length < 1)
		|| (document.artiosOrderForm.city.value.length < 1)
		|| (document.artiosOrderForm.state.value.length < 1)
		|| (document.artiosOrderForm.zip.value.length < 1) )
	{
		document.artiosOrderForm.errorMessage.value="Please enter all required fields including a valid email address."; 
	}
	
	document.artiosOrderForm.submit();
}


function validateOrderForm() {
	if ( (document.orderForm.email.value.indexOf(".") < 2) 
		|| (document.orderForm.email.value.indexOf("@") < 0) 
		|| (document.orderForm.firstName.value.length < 1)
		|| (document.orderForm.lastName.value.length < 1)
		|| (document.orderForm.address.value.length < 1)
		|| (document.orderForm.city.value.length < 1)
		|| (document.orderForm.state.value.length < 1)
		|| (document.orderForm.zip.value.length < 1)
		|| (document.orderForm.phone.value.length < 1)
		|| (document.orderForm.quantity0.value.length < 1) )
	{
		document.orderForm.errorMessage.value="Please enter all required fields including a valid email address."; 
	}
	
	document.orderForm.submit();
}

function validateReferForm() {
	if ( (document.referForm.yourEmail.value.indexOf(".") < 2) 
		|| (document.referForm.yourEmail.value.indexOf("@") < 0) 
		|| (document.referForm.firstName.value.length < 1)
		|| (document.referForm.lastName.value.length < 1)
		|| (document.referForm.friendEmail0.value.length < 1)
		|| (document.referForm.friendFirstName0.value.length < 1)
		|| (document.referForm.friendLastName0.value.length < 1) )
	{
		document.referForm.errorMessage.value="Please enter all required fields including valid email addresses."; 
	}
	
	document.referForm.submitFormBoolean.value="true";
	document.referForm.submit();
}



function showLayer(layer_ref) {

var state = 'visible';

if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.visibility = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].visibility = state;
}
if (document.getElementById && !document.all) {
maxwell_smart = document.getElementById(layer_ref);
maxwell_smart.style.visibility = state;
}
}

function hideLayer(layer_ref) {

var stateHidden = 'hidden';

if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.visibility = stateHidden");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].visibility = stateHidden;
}
if (document.getElementById && !document.all) {
maxwell_smart = document.getElementById(layer_ref);
maxwell_smart.style.visibility = stateHidden;
}
}


// This script allows to show and hide layes for a set of main browsers
// And can be used to construct pull-down menus

// All the Layers get names from menu0 to menu_vith_nomber_m
// If we want to hide all the layers 
// we call showmenu() function without parametrs
// i.e. using onMouseOver evant

function DOMGetElement(xx) 
{
  // This function returns document's elemtnt acording it's name
  // Using Document Object Model
 if (document.getElementById) return document.getElementById(xx); 
 return nul;
}

function showmenu(name) 
{
// This is the main function that hide all the layers but the only one, 
// which name was delivered to the function as a parametr

var ii;  // cicle variable
var m=2; // variable that shows maximum nomber in layers' names 
var qq;  // here we store the name of a layer that we must show
var nen; // here we store the names of all layers (in a cicle)

NeMenu =  new Array(m+1); // an array to store the objects -  all the layers that should be hidden
nename = new Array(m+1);  // an array to store the names of all the layers  that should be hidden

// cicle to store the names of all the layers that should be hidden an array
for (ii=0; ii<=m; ii++) {
  nen="menu" + ii;
  nename[ii]=nen;
   if (name) { // this
    if (nen==name) qq=ii; // flag on - if it's a name of a layer hat should be shown
   }
}

// than we should show one layer and hide all the others (in a cicle)
// we do it for all the main types of brousers 

  if (document.getElementById) { 
  // Type 1: IE5,6; NN6; Mozilla
  // if our brouser supports DOM and we can get an object according to it's name
    if (name) { // if there was a parametr
     var Menu = DOMGetElement(name); // get an object 
     Menu.style.visibility='visible'; // and show it, changing the style
    }
    for (ii=0; ii<=m; ii++) { // for all the layers
     if (ii!=qq) { // but one that should be shown
      NeMenu[ii] = DOMGetElement(nename[ii]); // get an object that we do NOT show
      NeMenu[ii].style.visibility='hidden';  // and hide it, changing the style
     }
    }
    return true; // exit function
  } // that's all for the first type of brousers

 if(document.all) { 
  // Type 2: For document.all stands IE4-6 and Opera5, but IE5,6 were gone as the 1-st type 
   if (name) document.all[name].style.visibility= 'visible'; //if there was a parametr, show that layer using style
  for (ii=0; ii<=m; ii++) { 
   // hide all the layers but one that should be shown  - using style
   if (ii!=qq) document.all[nename[ii]].style.visibility= 'hidden'; 
  }
    return true; // exit function
 } // that's all for the second type of brousers

 if (document.layers) { 
   //Type 2: NN4
   if (name) document.layers[name].visibility='show'; // if there was a parametr, show that layer using layer
    for (ii=0; ii<=m; ii++) {
    // hide all the layers but one that should be shown  - using layer
     if (ii!=qq) document.layers[nename[ii]].visibility='hide';
    }
    return true; // exit function
  } // that's all for the second type of brousers (NN4)
} 



