//COMMON SCRIPTS

var win=null;

function addLoadEvent(func) {
	var ssArray = "";
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

//setup vars - browser, etc.(For layer stuff)
var doc;
var style;
var px;

if (isNavigator())
{
	doc = document.layers;
	style = '';
	px='';
	
}
else
{
	var doc = document.all;
	var style = '.style';
	px='px';
}
	
/* SECURE FORMS */
// Using regular expressions to match the location.pathname
if (location.protocol == 'https:'  
	&& location.pathname.substring(location.pathname.lastIndexOf('/')+1) != 'purchase.jsp' 
	&& location.pathname != '/requestinformation/index.jsp'
	&& location.pathname != '/misc/subscribe.jsp'
	&& location.pathname != '/misc/feedback.jsp'
	&& location.pathname != '/misc/optout.jsp'
	&& location.pathname != '/sheraton_desert_oasis/reservations.jsp'
	&& location.pathname != '/westin_kierland_villas/reservations.jsp'
	&& location.pathname != '/westin_mission_hills_resort_villas/reservations.jsp'
	&& location.pathname != '/sheraton_mountain_vista/reservations.jsp'
	&& location.pathname != '/sheraton_pga_vacation_resort/reservations.jsp'
	&& location.pathname != '/sheraton_vistana_resort/reservations.jsp'
	&& location.pathname != '/sheraton_vistana_villages/reservations.jsp'
	&& location.pathname != '/westin_kaanapali_ocean_resort_villas/reservations.jsp'
	&& location.pathname != '/sheraton_broadway_plantation/reservations.jsp'
	&& location.pathname != '/westin_stjohn_resort_villas/reservations.jsp'
	&& location.pathname != '/loscabos/'
	&& location.pathname != '/loscabos/index.jsp'){
    window.location= 'http://' + location.host + location.pathname + location.search
}

function showDiv(name,left,top)
{
	divobj = eval('doc.'+name+ style);	
	divobj.left = (left) + px;	
	divobj.top = (top) + px;
	divobj.visibility = 'visible';
}

function hideDiv(name)
{
	divobj = eval('doc.'+name+ style);		
	divobj.visibility = 'hidden';
}


function moveXYMenu(where,menuName)
{

	menu_object = eval('doc.'+menuName+'menu' + style);		
	menu_object.left = (menu_loc[where] + backOffsetMenu) + px;	
	menu_object.top = (menu_top[where]+backOffsetMenu)+px;
}
function isNavigator()
{
 return navigator.appName.indexOf("Netscape") !=-1;
}

function isNumber(val)
{
	return val == 0 || (val!=0 && val/val==1);
}

function load(what)
{
	document.location.href=what;
}

function appendToUrl(strname,strval)
{
	var curLoc = document.location.href;
	if (curLoc.indexOf("?")==-1)
		document.location.href = curLoc + "?"+strname+"="+strval;
	else
		document.location.href = curLoc + "&"+strname+"="+strval;	
}	

function addToUrl(strname,strval)
{
	var curLoc = document.location.href;
	if (curLoc.indexOf("?")==-1)//nothing added yet, safe to do it whithout checks.
	{
		curLoc = curLoc + "?"+strname+"="+strval;
	}
		
	else
	{
		//check for the name first.
		found = false;
		split_url = curLoc.split("?");
		qs = split_url[1];
		split_qs = qs.split("&");
		this_val = new Array();
		for (i=0;i<split_qs.length;i++)
		{
			this_val = split_qs[i].split("=");
			if (this_val[0]==strname)
			{
				//found it
				split_qs[i]=this_val[0]+"="+strval;
				found = true;
				break;
			}
		}
		
		if (found)
		{
			split_url[1] = split_qs.join("&"); 
			curLoc = split_url.join("?");
		}
		else //just put it at the end
		{
			curLoc=curLoc+"&"+strname+"="+strval;
		}

	}
	
	document.location.href=curLoc;	

}

function cleanUrl() // returns the url without any query string stuff
{
	curLoc = document.location.href.split("?");
	return curLoc[0];
	
}

function ask(qst,loc)
{
	var y = confirm(qst);
	if (y)
		document.location.href = loc;
}
	
function popUp(what,attributes)
{
	if (!win || win.closed)
		win=window.open(what,"shop",attributes);
	else
	{
		win.location.href=what;
		win.focus();
	}
}	

function isIndexed(obj,errMsg)
{
	if (obj.selectedIndex==0)
	{
		alert(errMsg);
		return false;
	}
	else
		return true;

}

function requireCheck(obj,errMsg)
{
	var ok = false;
	for (i=0;i<obj.length;i++)
	{
		if (obj[i].checked)
		{
			ok=true;
			break;
		}
	}
	
	if (!ok) alert(errMsg);
	
	return ok;
}

function requireOne(obj1,obj2,errMsg)
{
	var val1 = eval("document.forms[0]."+obj1+".value");
	var val2 = eval("document.forms[0]."+obj2+".value");
	
	if (trim(val1)=="" && trim(val2)=="")
	{
		alert(errMsg);
		return false;
	}
	else
		return true;
}
	
function isEqual(str1,str2,errMsg)
{
	if (str1=="" || str2=="" || str1!=str2)
	{
		alert(errMsg);
		return false;
	}
	else
		return true;
}

function notEmpty()
{
	var ok = true;
	var arg = notEmpty.arguments;
	
	// special processing to handle custom form (not forms[0])
	var formName = "forms[0]";
	var startIndex = 0;
	if (arg.length > 0 && arg[0] == "custom") {
		formName = arg[1];
		startIndex = 2;
	}
	
	for(i=startIndex; i<arg.length; i+=2)
	{
		var val= eval("document."+formName+"."+arg[i]+".value");
		if (trim(val)=="")
		{
			ok=false;
			alert(arg[i+1]);
			eval("document."+formName+"."+arg[i]+".focus();");
			break;
		}
	}

	
	return ok;
}



function doZip(){

  var ok = true;
  
  if(document.forms[0].bstate.value != 'Outside United States'){
      ok = notEmpty('bzip','You must enter a Zip Code');
  }
  
  return ok;

}

function checkEmail (emailStr)
{

	/* Check to see the address ends in a two-letter country or well-known
	TLD.  1 means check it, 0 means don't. */
	var checkTLD=1;

	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

	/* The following pattern is used to check if the entered e-mail address
	fits the user@domain format.*/

	var emailPat=/^(.+)@(.+)$/;

	//Special chars:
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

	var validChars="\[^\\s" + specialChars + "\]";

	/* The following pattern applies if the user is a quoted string ->NO RULES!
	For instance, "alexthebest"@travelatro.com is a legal e-mail address. */

	var quotedUser="(\"[^\"]*\")";

	/* The following applies for domains that are IP addresses,
	rather than symbolic names. Ex: alex@[123.124.233.4] is ok.*/

	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

	var atom=validChars + '+';

	/* The following string represents one word in the typical username.
	For example, in alex.it@travelatro.com, alex and it are words.*/


	var word="(" + atom + "|" + quotedUser + ")";


	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

		
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

	//Validation:

	var matchArray=emailStr.match(emailPat);

	if (matchArray==null)
	{

	//Address does not match the basic pattern.

		alert("Please enter in a valid email address");
		return false;
	}
	
	var user=matchArray[1];
	var domain=matchArray[2];


	for (i=0; i<user.length; i++) 
	{
	 	if (user.charCodeAt(i)>127)
		{
			alert("The username for the email entered contains invalid characters.");
			return false;
		}
    }
	for (i=0; i<domain.length; i++)
	{
		if (domain.charCodeAt(i)>127)
		{
			alert("Ths domain name for the email entered contains invalid characters.");
			return false;
		}
	}

	//Is user ok?
	if (user.match(userPat)==null)
	{

	// NO!
		alert("The username for the email entered doesn't seem to be valid.");
		return false;
	}

	//Is the ip address valid? (If used one)?

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null)
	{
		//yes.

		for (var i=1;i<=4;i++)
		{
		
			if (IPArray[i]>255) 
			{
				alert("Destination IP address for the email entered is invalid!");
				return false;
			}
		}
		return true;
	}

	// Domain NAME -is it ok?
	 
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++)
	{
		if (domArr[i].search(atomPat)==-1)
		{
			alert("The domain name for the email entered does not seem to be valid.");
			return false;
	   }
	}


	if (checkTLD && domArr[domArr.length-1].length!=2 && 
	domArr[domArr.length-1].toLowerCase().search(knownDomsPat)==-1) 
	{
		alert("The email address must end in a well-known domain or two letter " + "country.");
		return false;
	}

// Make sure there's a host name preceding the domain.

	if (len<2)
	{
		alert("This email address is missing a hostname!");
		return false;
	}

	// If nothing happened so far, we are cool.
	return true;
}

function checkEmailNoAlerts (emailStr)
{

	/* Check to see the address ends in a two-letter country or well-known
	TLD.  1 means check it, 0 means don't. */
	var checkTLD=1;

	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

	/* The following pattern is used to check if the entered e-mail address
	fits the user@domain format.*/

	var emailPat=/^(.+)@(.+)$/;

	//Special chars:
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

	var validChars="\[^\\s" + specialChars + "\]";

	/* The following pattern applies if the user is a quoted string ->NO RULES!
	For instance, "alexthebest"@travelatro.com is a legal e-mail address. */

	var quotedUser="(\"[^\"]*\")";

	/* The following applies for domains that are IP addresses,
	rather than symbolic names. Ex: alex@[123.124.233.4] is ok.*/

	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

	var atom=validChars + '+';

	/* The following string represents one word in the typical username.
	For example, in alex.it@travelatro.com, alex and it are words.*/


	var word="(" + atom + "|" + quotedUser + ")";


	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

		
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

	//Validation:

	var matchArray=emailStr.match(emailPat);

	if (matchArray==null)
	{

	//Address does not match the basic pattern.

		return false;
	}
	
	var user=matchArray[1];
	var domain=matchArray[2];


	for (i=0; i<user.length; i++) 
	{
	 	if (user.charCodeAt(i)>127)
		{
			return false;
		}
    }
	for (i=0; i<domain.length; i++)
	{
		if (domain.charCodeAt(i)>127)
		{
			return false;
		}
	}

	//Is user ok?
	if (user.match(userPat)==null)
	{

	// NO!
		return false;
	}

	//Is the ip address valid? (If used one)?

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null)
	{
		//yes.

		for (var i=1;i<=4;i++)
		{
		
			if (IPArray[i]>255) 
			{
				return false;
			}
		}
		return true;
	}

	// Domain NAME -is it ok?
	 
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++)
	{
		if (domArr[i].search(atomPat)==-1)
		{
			return false;
	   }
	}


	if (checkTLD && domArr[domArr.length-1].length!=2 && 
	domArr[domArr.length-1].toLowerCase().search(knownDomsPat)==-1) 
	{
		return false;
	}

// Make sure there's a host name preceding the domain.

	if (len<2)
	{
		return false;
	}

	// If nothing happened so far, we are cool.
	return true;
}


function ltrim ( s )
{
	return s.replace( /^\s*/, "" )
}

function rtrim ( s )
{
	return s.replace( /\s*$/, "" );
}

function trim ( s )
{
	return rtrim(ltrim(s));
}

function selState(formname,fname,dropdown)
{

	if (dropdown.value!='United States of America' || dropdown.value!='USA')
		eval("document."+formname+"."+fname+".selectedIndex=52");
}

function selCountry(formname,fname,dropdown)
{
	if (dropdown.value=='Outside United States' ||dropdown.value=='N/A' || dropdown.value=='NA')
		eval("document."+formname+"."+fname+".selectedIndex=0");
	else
		eval("document."+formname+"."+fname+".value='United States of America'");	
}	



//validation scripts

function validateSSN(ssn)
{
	var ok = true;
	var matchArr = ssn.match(/^(\d{3})-?\d{2}-?\d{4}$/);
	var numDashes = ssn.split('-').length - 1;
	if (matchArr == null || numDashes == 1) 
	{
		alert('Invalid SSN. Must be 9 digits or in the form NNN-NN-NNNN.');
		msg = "does not appear to be valid";
		ok = false;
	}
	else if (parseInt(matchArr[1],10)==0) 
	{
		alert("Invalid SSN: SSN's can't start with 000.");
		msg = "does not appear to be valid";
		ok = false;
	}
	
	return ok;
}


function formatSSN(obj)
{
	keyHit = (isNavigator()) ? keyStroke.which : event.keyCode;

	val = obj.value;
	
	last = val.charAt(val.length-1);
	if (last=='0' || isNumber(last))
	{
		
		if (keyHit!=8 && (val.length==3 || val.length==6) && val.charAt(val.length-1)!="-")
			obj.value = val +"-";
	
	}
	else
		obj.value=val.substring(0,val.length-1);
			
}

function skip () { this.blur(); }

function disable (field) 
{
  if (document.all || document.getElementById) 
    field.disabled = true;
  else
  {
    field.oldOnFocus = field.onfocus;
    field.onfocus = skip;
  }
}

function enable (field) 
{
  if (document.all || document.getElementById)
    field.disabled = false;
  else 
  {
    field.onfocus = field.oldOnFocus;
  }
}

function controlLen(obj,len)
{
	if (obj.value.length > len)
		obj.value = obj.value.substring(0,obj.value.length-1);
}

function isAfterToday(year,month,day,sError)
{
	 var ok = false;	 
     var cYear = eval("document.forms[0]."+year+".value");
     var cMonth = eval("(document.forms[0]."+month+".value)-1");
     var cDay = eval("document.forms[0]."+day+".value");
     var d = new Date();
     var dYear = d.getYear();
     var dMonth = d.getMonth() + 1;
     var dDay = d.getDate();
	 adate = new Date(cYear,cMonth,cDay);
	 if (adate < d)
	 {
	 	alert(sError);
		ok = false;
	 }
	 
	 else
		ok = true;
		
	 return ok;     
 }
 
 function isAfter(syear,smonth,sday,eyear,emonth,eday,sError)
 {
 	 var ok = false;	 
     var ssYear = eval("document.forms[0]."+syear+".value");
     var ssMonth = eval("(document.forms[0]."+smonth+".value)-1");
     var ssDay = eval("document.forms[0]."+sday+".value");
     var eeYear = eval("document.forms[0]."+eyear+".value");
     var eeMonth = eval("(document.forms[0]."+emonth+".value)-1");
     var eeDay = eval("document.forms[0]."+eday+".value");
	 sdate = new Date(ssYear,ssMonth,ssDay);
	 
	 edate = new Date(eeYear,eeMonth,eeDay);
	 if (sdate > edate)
	 {
	 	alert(sError);
		ok = false;
	 }
	 
	 else
		ok = true;
		
	 return ok;     
 }
 
 //forces a check box to be checked at form submition
 //if already checked, the value does not change (true)
 //if unchecked, we check it and set its value to false so it is passed along.
 function forceCheck(obj)
 {
 	var chk = obj.checked;
	if (!chk)
	{
		chk.value = 'false';
		chk.checked = true;
	}
 }

// the following functions are used for the FQA 
// admin modifyOrder
function moveUP(){

  var selectedItem = document.form2.select1.selectedIndex;
  
  swapData(selectedItem,selectedItem-1); 
  

}

function moveDown(){

  var selectedItem = document.form2.select1.selectedIndex;
  
  swapData(selectedItem,selectedItem+1); 
  

}

function swapData(oldLoc, newLoc){

   var oldValue = document.form2.select1[oldLoc].value;
   var oldText =  document.form2.select1[oldLoc].innerText;
   
   var otherValue = document.form2.select1[newLoc].value;
   var otherText =  document.form2.select1[newLoc].innerText;
   
   
   document.form2.select1[newLoc].value = oldValue;
   document.form2.select1[newLoc].innerText = oldText;
   
   document.form2.select1[oldLoc].value = otherValue;
   document.form2.select1[oldLoc].innerText = otherText;
   
   document.form2.select1.selectedIndex = newLoc;

}

function SelectAll(objSelect) {
 
	var i = 0; 

	while (i < objSelect.length) {

	objSelect.options[i].selected = true; 

	i++; 

	} 
} 

//end functions for the faq modifyOrder

//begin functions for faq admin create category/section
function returnCheckPullDown(){

var bolValue = true;
var alertStr = "";

if(document.form1.faq_section){

	if(document.form1.faq_section.selectedIndex == 0){
	
		bolValue = false;
		alertStr += "Please select a section\r\n";
	
	}
	
	if(document.form1.faq_category){
	
		if(document.form1.faq_category.selectedIndex == 0){
		
			bolValue = false;
			alertStr += "Please select a category\r\n";
		
		}
	
	}

}

if(!bolValue) alert(alertStr);

return bolValue;

}
//end functions for faq admin create category/section

<!--
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_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_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];}
}
//-->


/*  TRAVELATRO SITE-SNIFFER */
function getSiteName() {
 var url = ""
 url = "" + window.location
 var s_server = "SVO"
 if (url.indexOf("www.starwoodvacationownership.com") == -1) {
    s_server += "_NONPROD";
 } //end if
 return s_server;
} //end function

// frame buster
	// Hide script from older browsers
	//setTimeout ("changePage()", 1000);

	//function changePage() {
		//if (self.parent.frames.length != 0)
			//self.parent.location=document.location;
		//}

	// end hiding contents
// frame buster fine'

// centered pop-up script
	function OpenBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
	  if(window.screen)if(isCenter)if(isCenter=="true"){
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
	  }
	  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
	}	
// centered pop-up script fine'

// simple pop-up script
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
// simple pop-up script fine'
	
// jump menu goto script
	function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
// jump menu script fine'
	
// form button goto script
	function MM_goToURL() { //v3.0
	  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	}
// form button goto script fine'

/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera */
function bookmark(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}
		
///////////////////////
		
// css dropdown script

var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=1 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)

/////No further editting needed

var ie5=document.all
var ns6=document.getElementById&&!document.all

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){
if (ie5||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
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=ie5 && !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=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !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 dropdownmenu(obj, e, dropmenuID){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
if (typeof dropmenuobj!="undefined") //hide previous menu
dropmenuobj.style.visibility="hidden"
clearhidemenu()
if (ie5||ns6){
obj.onmouseout=delayhidemenu
dropmenuobj=document.getElementById(dropmenuID)
if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
dropmenuobj.onmouseover=clearhidemenu
dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
showhide(dropmenuobj.style, e, "visible", "hidden")
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 ((ie5||ns6) && !enableanchorlink) 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 (ie5&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

// end css dropdown script

//determines spacing between answers on home page poll widget because IE and Mozilla render differently
function spacing( ) {
	d = document;
	if ( ie ){
		d.write('<img src="/images/spacer.gif" width="1" height="3">');
	}
	else {
		d.write('<img src="/images/spacer.gif" width="1" height="7">');
	}
}
// end spacing