function sethoveron(){
	hover = 1;
	//alert('on');
}
function sethoveroff(){
 	hover = 0;
 	//alert('off');
}

//Contents for menu 1
var menu1=new Array();
menu1[0]='<p class="submenu"><a href="http://Charm-Express.com/login.cfm?" title="If you are already a member, user your user and password to log in">Login</a>';
menu1[1]='<br><a href="http://Charm-Express.com/OrderForm.cfm?createAccount=1" title="Register to become a member of Charm-Express.">Create Account</a>';
menu1[2]='<br><a href="http://Charm-Express.com/OrderStatus.cfm?orderStat=yes" title="View order status with your order number">Check Order Status</a>';
menu1[3]='<br><a href="http://Charm-Express.com/wishlist.cfm?CreateWishList=yes" title="If you are already a member, you may create a wish list">Create Wish List</a>';
menu1[4]='<br><a href="http://Charm-Express.com/wishlist.cfm?ViewWishList=yes" title="If you are already a member with a wish list, you may view, edit, remove and add item to your wish list">View My Wish List</a>';
menu1[5]='<br><a href="http://Charm-Express.com/wishlist.cfm?FindWishList=yes" title="Find member with a wish list">Find Wish List</a>';
menu1[6]='<br>';
menu1[7]='<br><br><br><br>';
menu1[8]='</p>';

//Contents for menu 2, and so on
var menu2=new Array();
menu2[0]='<p class="submenu"><a href="http://Charm-Express.com/contact-us.cfm" title="Contact information, submit suggestion or comments.">Contact Us</a>';
menu2[1]='<br><a href="http://Charm-Express.com/satisfaction-guaranteed.html" title="Read about our statisfaction guaranteed.">Statisfaction Guaranteed</a>';
menu2[2]='<br><a href="http://Charm-Express.com/guaranteed-lowest-price.html" title="Read about our Guaranteed Lowest Price.">Guaranteed Lowest Price</a>';
menu2[3]='<br><a href="http://Charm-Express.com/order-status.html" title="Read about our Shipping Information.">Shipping Information</a>';
menu2[4]='<br><a href="http://Charm-Express.com/return-policy.html" title="Read about our Return Policy.">Return Policy</a>';
menu2[5]='<br><a href="http://Charm-Express.com/StateOfTheArtSecurity.html" title="Read about our State-of-the-Art Site Security.">State-of-the-Art Site Security</a>';
menu2[6]='<br><a href="http://Charm-Express.com/freebees.html" title="Read about our Free Bees.">Free Bees</a>';
menu2[7]='<br><a href="http://Charm-Express.com/wholesale.html" title="Read about our Wholesale Orders opportunity.">Wholesale Orders</a>';
menu2[8]='</p>';
function opwWindow()
{	newwindow = window.open('charmedlife.html','name','height=730,width=855,resizable=1');
	if (window.focus) {newwindow.focus()} return false;
}
//Contents for menu 3, and so on
var menu3=new Array();
menu3[0]='<p class="submenu"><a href="/our-charmed-lives-contents.html" title="Tell us about your charmed life and earn free charms.">Our Customers&#39;<br> Charmed Lives</a>';
menu3[1]='<br><a href="/charmedlife.html" title="Earn Charm Dollars Today by Sharing Stories From Our Customers Charmed Lives">How to Submit Your<br> Story About Your<br> Charm Jewelry</a>';
menu3[2]='<br><a href="/my-charmed-life-contents.html" title="Read about Story of charms.">My Life In Charms</a>';
menu3[3]='<br><a href="/howCharmsAreMade.html" title="View video of how charms are made.">How Charms <br> Are Made</a>';
menu3[4]='<br><a href="/history-of-charms.html"  title="Learn more about charms.">History of Charms</a>';
menu3[5]='<br><a href="/accolades.html" title="Read about what our customers have experience from their feed-back.">Our Customers&#39;<br> Charming Feedback</a>';
menu3[6]='</p>';
var menuwidth='165px'; //default menu width
var menubgcolor='#875e45;'; //menu bgcolor

var disappeardelay=250;  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes"; //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all;
var ns6=document.getElementById&&!document.all;

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'filter:alpha(opacity=92);-moz-opacity:.92;opacity:.92;position:absolute; z-index:101;'+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)" class="utility-menu3"></div>');

function getposOffset(what, offsettype)
{	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null)
	{		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
			parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}
function showhide(obj, e, visible, hidden, menuwidth)
{	if (ie4||ns6)
	{	dropmenuobj.style.left=dropmenuobj.style.top="-500px";
	}
	if (menuwidth!="")
	{	dropmenuobj.widthobj=dropmenuobj.style;
		dropmenuobj.widthobj.width=menuwidth;
	}
	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
	{	obj.visibility=visible;
	}else if (e.type=="click")
	{
		obj.visibility=hidden;
	}
}

function iecompattest()
{	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function clearbrowseredge(obj, whichedge)
{	var edgeoffset=0;
	if (whichedge=="rightedge")
	{	var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15;
		dropmenuobj.contentmeasure=dropmenuobj.offsetWidth;
		if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
		{	edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth;
		}
	}else
	{	var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset;
		var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18;
		dropmenuobj.contentmeasure=dropmenuobj.offsetHeight;
		if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)//move up?
		{	edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight;
			if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
			{	edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge;
			}
		}
	}
	return edgeoffset;
}

function populatemenu(what)
{	if (ie4||ns6)
	{dropmenuobj.innerHTML=what.join("");
	}
}

function dropdownmenu(obj, e, menucontents, menuwidth)
{	if (window.event)
	{ 	event.cancelBubble=true;
	}
	else if (e.stopPropagation)
	{	 e.stopPropagation();
	}
	clearhidemenu()
	dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv;
	populatemenu(menucontents)
	if (ie4||ns6)
	{	showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth);
		dropmenuobj.x=getposOffset(obj, "left");
		dropmenuobj.y=getposOffset(obj, "top");
		dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px";
		dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px";
	}
	return clickreturnvalue();
}
function clickreturnvalue()
{	if (ie4||ns6)
	{	return false;
	}else
	{ return true;
	}
}
function contains_ns6(a, b)
{	while (b.parentNode)
	{	if ((b = b.parentNode) == a)
		{	return true;
		}
	}
	return false;
}

function dynamichide(e)
{	if (ie4&&!dropmenuobj.contains(e.toElement))
	{	delayhidemenu();
	}else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
	{		delayhidemenu();
	}
}

function hidemenu(e)
{	if (typeof dropmenuobj!="undefined")
	{	if (ie4||ns6)
		{	dropmenuobj.style.visibility="hidden";
		}
	}
}

function delayhidemenu()
{	if (ie4||ns6)
	{delayhide=setTimeout("hidemenu()",disappeardelay);
	}
}

function clearhidemenu()
{	if (typeof delayhide!="undefined")
	{	clearTimeout(delayhide);
	}
}

if (hidemenu_onclick=="yes")
{	document.onclick=hidemenu;
}
function SearchSubmit()
{	var BrowserDetect = {
				init: function () {
					this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
					this.version = this.searchVersion(navigator.userAgent)
					|| this.searchVersion(navigator.appVersion)
					|| "an unknown version";
					this.OS = this.searchString(this.dataOS) || "an unknown OS";
				},
				searchString: function (data) {
				for (var i=0;i<data.length;i++)	{
					var dataString = data[i].string;
					var dataProp = data[i].prop;
					this.versionSearchString = data[i].versionSearch || data[i].identity;
					if (dataString) {
						if (dataString.indexOf(data[i].subString) != -1)
								return data[i].identity;
						}
						else if (dataProp)
							return data[i].identity;
						}
					},
					searchVersion: function (dataString) {
					var index = dataString.indexOf(this.versionSearchString);
					if (index == -1) return;
						return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
					},
					dataBrowser: [
					{ 			string: navigator.userAgent,
						subString: "OmniWeb",
						versionSearch: "OmniWeb/",
						identity: "OmniWeb"
					},
					{
						string: navigator.vendor,
						subString: "Apple",
						identity: "Safari"
					},
					{
						prop: window.opera,
						identity: "Opera"
					},
					{
						string: navigator.vendor,
						subString: "iCab",
						identity: "iCab"
					},
					{
						string: navigator.vendor,
						subString: "KDE",
						identity: "Konqueror"
					},
					{
						string: navigator.userAgent,
						subString: "Firefox",
						identity: "Firefox"
					},
					{
						string: navigator.vendor,
						subString: "Camino",
						identity: "Camino"
					},
					{		// for newer Netscapes (6+)
						string: navigator.userAgent,
						subString: "Netscape",
						identity: "Netscape"
					},
					{
						string: navigator.userAgent,
						subString: "MSIE",
						identity: "Explorer",
						versionSearch: "MSIE"
					},
					{
						string: navigator.userAgent,
						subString: "Gecko",
						identity: "Mozilla",
						versionSearch: "rv"
					},
					{ 	// for older Netscapes (4-)
						string: navigator.userAgent,
						subString: "Mozilla",
						identity: "Netscape",
						versionSearch: "Mozilla"
					}
				],
				dataOS : [
					{
						string: navigator.platform,
						subString: "Win",
						identity: "Windows"
					},
					{
						string: navigator.platform,
						subString: "Mac",
						identity: "Mac"
					},
					{
						string: navigator.platform,
						subString: "Linux",
						identity: "Linux"
					}
				]

			};
			BrowserDetect.init();

				document.topsearch.bfamily.value = BrowserDetect.browser;
				
	document.topsearch.submit();
	if(window.load == 1){
		document.getElementById("frontPageSearchLoading").style.display="none";
		document.getElementById("frontPageSearchSubmit").style.display="inline";
		document.getElementById('searchLoad').style.display="none";
	}
	else if(window.load == 2)
	{	document.getElementById("frontPageSearchLoading").style.display="inline";
		document.getElementById("frontPageSearchSubmit").style.display="none";
		document.getElementById('searchLoad').style.display="inline";

	}
	else{
		document.getElementById("frontPageSearchLoading").style.display="inline";
		document.getElementById("frontPageSearchSubmit").style.display="none";
		document.getElementById('searchLoad').style.display="inline";
	}
}

function jumpTo(URL_List){
   	var URL = URL_List.options[URL_List.selectedIndex].value;
   	window.location.href = URL;
}
function remBrantAlert(){
	alert("Please note that it takes approximately three weeks for your charm to be made into either a tie-tac, lapel pin, or charm holder.\n\n*Note: Customized items are non-returnable.");
}
function notStatisfy()
{	alert('Fill-out the right information!!!');
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImage2(id, source)  //v3.0
{	if (document.getElementById(id) !=null)
  	{	document.getElementById(id).src = source;
	}
}
function MM_swapImgRestore2(id, source) //v3.0
{  if (document.getElementById(id) !=null)
  	{	document.getElementById(id).src = source;
	}
}

function switchVideo(v){
	var so = new SWFObject(v, "flashinside", "314", "225", "9");
	so.addParam("wmode", "transparent");
	so.write("noflash");
}

function CallJS(jsStr) {
	if(document.getElementById('searchLoad') != null && document.getElementById('searchLoad') != 'undefined'){
		document.getElementById('searchLoad').src = "/images/Search-loader.gif";
	}
}
function Get_Cookie(name) { 
   var start = document.cookie.indexOf(name+"="); 
   var len = start+name.length+1; 
   if ((!start) && (name != document.cookie.substring(0,name.length))) return null; 
   if (start == -1) return null; 
   var end = document.cookie.indexOf(";",len); 
   if (end == -1) end = document.cookie.length;   
   return unescape(document.cookie.substring(len,end)); 
} 

function Set_Cookie(name,value,expires,path,domain,secure) { 
    var cookieString = name + "=" +escape(value) + 
       ( (expires) ? ";expires=" + expires.toGMTString() : "") + 
       ( (path) ? ";path=" + path : "") + 
       ( (domain) ? ";domain=" + domain : "") + 
       ( (secure) ? ";secure" : ""); 
    document.cookie = cookieString; 
} 

function Delete_Cookie(name,path,domain) { 
   if (Get_Cookie(name)) document.cookie = name + "=" + 
      ( (path) ? ";path=" + path : "") + 
      ( (domain) ? ";domain=" + domain : "") + 
      ";expires=Thu, 01-Jan-70 00:00:01 GMT"; 
}

var today = new Date(); 
var zero_date = new Date(0,0,0); 
today.setTime(today.getTime() - zero_date.getTime()); 
var cookie_expire_date = new Date(today.getTime() + (8 * 7 * 86400000)); 
function toggle_visibility(id) {
    var e = document.getElementById(id);
     if(e.style.display == 'block'){
	   	Set_Cookie(id,'none',cookie_expire_date); 
        e.style.display = 'none';
	 }else{
        e.style.display = 'block';
		Set_Cookie(id,'block',cookie_expire_date); 
	}
}
function showHide(id){
	var cCookie = Get_Cookie(id);	
	if(cCookie == 'none'){
		document.getElementById(id).style.display = 'none';
	}else if(cCookie == 'block'){
		document.getElementById(id).style.display = 'block';
	}
}

var ajax = new Array();
	function jumpTo(URL_List){
   		var URL = URL_List.options[URL_List.selectedIndex].value;
   		window.location.href = URL;
	}
	function remBrantAlert(sel, skuID){		
		var id = sel.value;
		var index = ajax.length;
		ajax[index] = new sack();		
		ajax[index].requestFile = 'getOptionMessage.cfm?skuID='+id;	// Specifying which file to get
		ajax[index].onCompletion = function(){ processRemBrantAlert(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
		return true;
	}
	function processRemBrantAlert(index){
		eval(ajax[index].response);	
	}
	function notStatisfy()
	{	alert('Fill-out the right information!!!');
	}

var allOn = true;
function SelectAll(MyForm,MyBox){
var countBoxes = eval("document."+MyForm+"."+MyBox+".length");
	if(!countBoxes){
		eval("document."+MyForm+"."+MyBox+".checked =  allOn");
	}
	else{
		for (var i=0; i<countBoxes ;i++){
			eval("document."+MyForm+"."+MyBox+"[i].checked =  allOn");
		}
	}
allOn = !allOn;
}

function cleanField(obj){
	obj.value = obj.value.replace(/[^\d]/g,"");
	if(obj.value.length == 0 || obj.value == 0){obj.value=1}
}


startStack=function() { };  // A stack of functions to run onload/domready

registerOnLoad = function(func) {
   var orgOnLoad = startStack;
   startStack = function () {
      orgOnLoad();
      func();
      return;
   }
}

var ranOnload=false; // Flag to determine if we've ran the starting stack already.

if (document.addEventListener) {
  // Mozilla actually has a DOM READY event.
   document.addEventListener("DOMContentLoaded", function(){if (!ranOnload) {ranOnload=true; startStack();}}, false);
}  else if (document.all && !window.opera) {
  // This is the IE style which exploits a property of the (standards defined) defer attribute
  document.write("<scr" + "ipt id='DOMReady' defer=true " + "src=//:><\/scr" + "ipt>");  
  document.getElementById("DOMReady").onreadystatechange=function(){
    if (this.readyState=="complete"&&(!ranOnload)){
      ranOnload=true;
      startStack();
    }
  }
}

var orgOnLoad=window.onload;
window.onload=function() {
   if (typeof(orgOnLoad)=='function') {
      orgOnLoad();
   }
   if (!ranOnload) {
     ranOnload=true;
     startStack();
   }
}

function setLoad(sel){
	if(document.getElementById('searchLoad') != null && document.getElementById('searchLoad') != 'undefined'){
		document.getElementById('searchLoad').style.display="inline";
	}
	if(sel == 'boutique'){	
		document.getElementById('category').selectedIndex = 0;	
		document.getElementById('secondary').selectedIndex = 0;
		document.getElementById('title').selectedIndex = 0;
	}
	if(sel == 'category'){		
		document.getElementById('secondary').selectedIndex = 0;
		document.getElementById('title').selectedIndex = 0;
	}
	if(sel == 'secondary'){		
		document.getElementById('title').selectedIndex = 0;
	}
	frmCatSearch.submit();	
}

