var cssdropdown={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: true, //when user clicks on a menu item with a drop down menu, disable menu item's link?
enableswipe: 1, //enable swipe effect? 1 for yes, 0 for no
enableiframeshim: 1, //enable "iframe shim" technique to get drop down menus to correctly appear on top of controls such as form objects in IE5.5/IE6? 1 for yes, 0 for no

//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,

getposOffset:function(what, offsettype)
{
	try
	{
		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;
	}catch(e)
	{
		alert('getposOffset:function:  '+e)
	}
},
swipeeffect:function()
{
	try
	{
		if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight))
		{
			this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
			this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
		}
		return this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 60)
		
	}catch(e)
	{
		alert('swipeeffect:function:  '+e)
	}
},

showhide:function(obj, e)
{
	try
	{
		if (this.ie || this.firefox)
		this.dropmenuobj.style.left=this.dropmenuobj.style.top="0px"
		if (e.type=="mouseover")
		{
			if (this.enableswipe==1)
			{
				if (typeof this.swipetimer!="undefined")
				clearTimeout(this.swipetimer)
				obj.clip="rect(0 auto 0 0)" //hide menu via clipping
				this.bottomclip=1
				this.swipeeffect()
			}
			obj.visibility="visible"
		}
	}catch(e)
	{
		alert('showhide:function:  '+e)
	}
},

iecompattest:function()
{
	try
	{
		return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}catch(e)
	{
		alert('iecompattest:function:  '+e)
	}
},

clearbrowseredge:function(obj, whichedge)
{
	try
	{
		var edgeoffset=0
		if (whichedge=="rightedge")
		{
			var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
			this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
			if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
				edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
		}else{
			var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
			var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
			this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
			if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
			edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
			if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
			edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
			}
		}
	  	return edgeoffset
	  }catch(e)
	  {
		alert('clearbrowseredge:function:  '+e)
	  }
},

dropit:function(obj, e, dropmenuID){
   try
   {		
		if (this.dropmenuobj!=null) //hide previous menu
		this.dropmenuobj.style.visibility="hidden" //hide menu
		this.clearhidemenu()
		if (this.ie||this.firefox){
		obj.onmouseout=function(){cssdropdown.delayhidemenu()}
		//obj.onclick=function(){ alert(dropmenuID);} //disable main menu item link onclick?
		this.dropmenuobj=document.getElementById(dropmenuID)
		this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
		this.dropmenuobj.onmouseout=function(e){cssdropdown.dynamichide(e)}
		
		this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
		
		this.showhide(this.dropmenuobj.style, e)
		this.dropmenuobj.x=this.getposOffset(obj, "left")
		this.dropmenuobj.y=this.getposOffset(obj, "top")
		this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
		this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
		this.positionshim() //call iframe shim function
		}
  }catch(e)
	  {
		alert('dropit:function:  '+e)
	  }
},

positionshim:function(){ //display iframe shim function
  try
  {
	if (this.enableiframeshim && typeof this.shimobject!="undefined"){
	if (this.dropmenuobj.style.visibility=="visible"){
	this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
	this.shimobject.style.height=this.dropmenuobj.offsetHeight+"px"
	this.shimobject.style.left=this.dropmenuobj.style.left
	this.shimobject.style.top=this.dropmenuobj.style.top
	}
	this.shimobject.style.display=(this.dropmenuobj.style.visibility=="visible")? "block" : "none"
	}
  }catch(e)
  {
	alert('positionshim:function:  '+e)
   }
},

hideshim:function(){
  try
  {
	if (this.enableiframeshim && typeof this.shimobject!="undefined")
	this.shimobject.style.display='none'
  }catch(e)
  {
	alert('hideshim:function:  '+e)
   }
},

contains_firefox:function(a, b) {
 try{	
	while (b.parentNode)
	if ((b = b.parentNode) == a)
	return true;
	return false;
  }catch(e)
  {
	alert('contains_firefox:function:  '+e)
   }
},

dynamichide:function(e){
 try{	
	var evtobj=window.event? window.event : e
	if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
	this.delayhidemenu()
	else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
	this.delayhidemenu()
  }catch(e)
  {
	alert('dynamichide:function:  '+e)
   }
},

delayhidemenu:function(){
 try{
  this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'; cssdropdown.hideshim()",this.disappeardelay) //hide menu
  }catch(e)
  {
	alert('delayhidemenu:function:  '+e)
  }
 
},

clearhidemenu:function(){
 try{	
	if (this.delayhide!="undefined")
	clearTimeout(this.delayhide)
   }catch(e)
  {
	alert('clearhidemenu:function:  '+e)
  }
},

startdm:function(){
	try{
		for (var ids=0; ids<arguments.length; ids++){
		var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
		for (var i=0; i<menuitems.length; i++){
		if (menuitems[i].getAttribute("rel")){
		var relvalue=menuitems[i].getAttribute("rel")
		menuitems[i].onmouseover=function(e){
		var event=typeof e!="undefined"? e : window.event
		
		cssdropdown.dropit(this,event,this.getAttribute("rel"))
		}
		}
		}
		}
   }catch(e)
   {
	 alert('startdm:function:  '+e)
   }

}

}

function removeSpaces(string) {
 return string.split(' ').join('');
}

function search_main_validation()
{

 try{

   if((removeSpaces(document.getElementById('main_searchtxt').value)=="") || (document.getElementById('main_searchtxt').value=="Enter Keywords"))
   {
	  alert("Please enter Keywords.");
	  document.getElementById('main_searchtxt').focus();
	  return false;
	}
	  
	  
 }catch(e)
 {
	 alert('search_main_validation:  '+e)
 }
}


function search_validation()
{
  try{
	  if((removeSpaces(document.getElementById('searchtxt').value)=="") || (document.getElementById('searchtxt').value=="Enter Keywords")){
	  alert("Please enter Keywords.");
	  document.getElementById('searchtxt').focus();
	  return false;
	  }
	  
	  if(document.getElementById('searchtxt').value.length <= 1){
	   alert("Please enter more then one characters");
	 return false;
	  }
  }catch(e)
 	{
	 alert('search_validation:  '+e)
 	}
}
	
	// JavaScript Document
function SetHomepage() {
   try{
		if (document.all)
		{
			document.body.style.behavior='url(#default#homepage)';
			document.body.setHomePage('http://www.desimartini.com');
	 
		}else if (window.sidebar)
		{
			// Mozilla Firefox Bookmark 
		alert("you need to drag this link and drop it on the home page icon in the top tool bar");
		}
    }catch(e)
 	{
	 alert('SetHomepage:  '+e)
 	}
		
		
}



function getCalendarDate()
{
 try{
	   var months = new Array(13);
	   months[0]  = "January";
	   months[1]  = "February";
	   months[2]  = "March";
	   months[3]  = "April";
	   months[4]  = "May";
	   months[5]  = "June";
	   months[6]  = "July";
	   months[7]  = "August";
	   months[8]  = "September";
	   months[9]  = "October";
	   months[10] = "November";
	   months[11] = "December";
	   var now         = new Date();
	   var monthnumber = now.getMonth();
	   var monthname   = months[monthnumber];
	   var monthday    = now.getDate();
	   var year        = now.getYear();
	   if(year < 2000) { year = year + 1900; }
	   var dateString = monthname +
						' ' +
						monthday +
						', ' +
						year;
	   return dateString;
  }catch(e)
  {
	alert('getCalendarDate:  '+e)
   }
 
}

function getClockTime()
{
  try{
   var now    = new Date();
   var hour   = now.getHours();
   var minute = now.getMinutes();
   var second = now.getSeconds();
   var ap = "AM";
   if (hour   > 11) { ap = "PM";             }
   if (hour   > 12) { hour = hour - 12;      }
   if (hour   == 0) { hour = 12;             }
   if (hour   < 10) { hour   = "0" + hour;   }
   if (minute < 10) { minute = "0" + minute; }
   if (second < 10) { second = "0" + second; }
   var timeString = hour +
                    ':' +
                    minute +
                    ':' +
                    second +
                    " " +
                    ap;
   return timeString;
   }catch(e)
   {
	alert('getClockTime:  '+e)
   }
  
}
