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 displayClassDetails(divName) {
	for(i = 0; i<popupDivs.length; i++) {
		if(popupDivs[i]!=divName) {
			//here, close the div with name = popupDivs[i]	
		}	
	}	
}


function jump(form) {var myindex=form.changeLocation.selectedIndex
	if(form.changeLocation.options[myindex].value != "0") {window.open(form.changeLocation.options[myindex].value, target="_self");
	}
}



function toggle (switcher) { 

  if(! document.getElementById)
    throw complainting("Your browser's JavaScript system is too old.  ",
       "Upgrade at getfirefox.com !");

  for(var i = 1; i < arguments.length; i++) {
    var element
    var el = document.getElementById( arguments[i] );
    if(!el) throw complaining("Failed to find element with id='"
     + arguments[i] + "' in " + document.location );

    var behidden;
    if(   (el.style.display || 'block') == 'block')
         { el.style.display =  'none' ; behidden = true ;  }
    else { el.style.display =  'block'; behidden = false;  }
  }

  return false;
}

function status_switcher_classchange (targetnode, behidden) {
  var class_to_add = behidden ? "toggleWillShow" : "toggleWillHide";

  var c = targetnode.className || '';
  var c_new =  c.replace( /\btoggleWill(Show|Hide)\b/, class_to_add );
  if( c_new == c)  { c_new = c + " " + class_to_add }
  targetnode.className = c_new;
  return;
}

function complaining () {
  var _ = [];
  for(var i = 0; i < arguments.length; i++) { _.push(arguments[i]) }
  _ = _.join("");
  if(! _.length) out = "Unknown error!?!";
  void alert(_);
  return new Error(_,_);
}

function CheckForm()
{
	var errs = '';
	if (document.contact_form.password.value != document.contact_form.confirm_pass.value)	errs = errs+'\nPlease make sure your passwords match.\n'
	
	if (document.contact_form.contact_email.value == '')			errs = errs+'\nPlease enter your email address.\n'
	if (document.contact_form.first_name.value == '')				errs = errs+'\nPlease enter your first name.\n'
	if (document.contact_form.last_name.value == '')				errs = errs+'\nPlease enter your last name.\n'
	if (document.contact_form.contact_phone.value == '')			errs = errs+'\nPlease enter your phone number.\n'
	
	if (errs == '') document.contact_form.submit();
	else alert(errs);
}


function CheckWarranty()
{
	var errs = '';

	if (document.warranty_form.items.value == '')			errs = errs+'\nPlease enter which items you would like repaired.\n'
	if (!document.warranty_form.sign.checked)				errs = errs+'\nPlease check the box to acknowledge all items are complete.\n'

	if (errs == '') document.warranty_form.submit();
	else alert(errs);
}

function CheckRequest()
{
	var errs = '';
	if (document.warranty_form.topic.value == '')			errs = errs+'\nPlease select a topic.\n'
	if (document.warranty_form.message.value == '')				errs = errs+'\nPlease enter a message.\n'
	
	if (errs == '') document.warranty_form.submit();
	else alert(errs);
}

function CheckVendor()
{
	var errs = '';
	if (document.content_form.vendor_name.value == '')			errs = errs+'\nPlease enter a Vendor Name.\n'
	
	if (errs == '') document.content_form.submit();
	else alert(errs);
}


function Rollover(imgName,imgSrc) { document.images[''+imgName+''].src = imgSrc; }

function button_roll(button,wax)
{
 button.style.backgroundColor=(wax=="on")?"#FFFFFF":"#e4ded8";
 button.style.color=(wax=="on")?"#000000":"000000";
}

// this might need translating, if so, move it to the page and use definitions in place of error texts...
function checkGroupName()
{
	var errs = '';
	if (document.newgroup.group_name.value == '') 		errs = errs+'\nPlease enter a group name'
	if (errs == '') document.newgroup.submit();
	else alert(errs);
}

function CheckContent(){

	var errs = '';
	if (document.content_form.title.value == '') 		errs = errs+'\nPlease enter a Title'
	if (document.content_form.category.value == '') 	errs = errs+'\nPlease choose a Category'
	if (document.content_form.status.value == '') 	errs = errs+'\nPlease choose a Status'
	//if (document.content_form.summary.value == '') 	errs = errs+'\nPlease enter a Summary'
	if (document.content_form.article_type[2].checked && document.content_form.url.value=='') 	errs = errs+'\nPlease enter a valid Internet URL for the article type chosen'

	if ((document.content_form.article_type[3].checked) && (document.content_form.userfile.value=='') && (!document.getElementById("uploaded"))) 	errs = errs+'\nPlease Upload a File for the article type chosen'
	
	//check for valid date range
	if (((document.content_form.to_year.value != "") || (document.content_form.to_mon.value != "") || (document.content_form.to_day.value != "")) && ((document.content_form.year.value > document.content_form.to_year.value) || ((document.content_form.year.value == document.content_form.to_year.value) && (document.content_form.mon.value > document.content_form.to_mon.value)) || ((document.content_form.year.value == document.content_form.to_year.value) && (document.content_form.mon.value == document.content_form.to_mon.value) && (document.content_form.day.value > document.content_form.to_day.value)))) errs = errs+'\nThe Expiration Date is less than the Date'
	
	if (errs == '') {
		document.content_form.submit();
		return true;
	}
	else {
		alert(errs);
		return false;
	}

}

function CheckCareers(){

	var errs = '';
	if (document.content_form.title.value == '') {
		errs = errs+'\nPlease enter a Title';
	}
	
	//check for valid date range
	if (((document.content_form.to_year.value != "") || (document.content_form.to_mon.value != "") || (document.content_form.to_day.value != "")) && ((document.content_form.year.value > document.content_form.to_year.value) || ((document.content_form.year.value == document.content_form.to_year.value) && (document.content_form.mon.value > document.content_form.to_mon.value)) || ((document.content_form.year.value == document.content_form.to_year.value) && (document.content_form.mon.value == document.content_form.to_mon.value) && (document.content_form.day.value > document.content_form.to_day.value)))) {
		errs = errs+'\nThe Expiration Date is less than the Date';
	}
	
	if (errs != '') {
		alert(errs);
		return false;
	}

}

function CheckStaff(){
	
	var errs = '';
	if (document.content_form.first_name.value == '') {
		errs = errs+'\nPlease enter a First Name.';
	}

	
	if (errs != '') {
		alert(errs);
		return false;
	}
}

function CheckDescriptions(){
	
	var errs = '';
	if (document.content_form.title.value == '') {
		errs = errs+'\nPlease enter a Title';
	}
	
	if (errs != '') {
		alert(errs);
		return false;
	}
}

function CheckUser(){
	var errs = '';
	if (document.content_form.username.value == '') 		errs = errs+'\nPlease enter a Username'
	if (document.content_form.password.value == '') 		errs = errs+'\nPlease enter a Password'
	if (errs == '') document.content_form.submit();
	else alert(errs);
}

function CheckContact(){
	var errs = '';
	var emailchar = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (document.content_form.email.value == '') 		errs = errs+'\nPlease enter an Email Address'
	else if (!emailchar.test(document.content_form.email.value)){
		errs = errs+'\nPlease enter a valid Email Address.';
	}
	
	if (errs == '') document.content_form.submit();
	else alert(errs);
}


function checkemail(){
	var email = document.basic_email.email.value;
	var emailchar = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
	if (email == ""){
		alert("Please enter your email address.");
		return false;
	}
	else if (!emailchar.test(email)){
		alert("Please enter a valid email address.");
		return false;
	}
	else {
		return true;
	}
}

function CheckPhoneLen(num)
{
	// alert(num);
	if (num.length != 12 && num.length != "0") alert('Please enter only a ten digit phone number, formatted ###-###-####');
	
}

function enableTopics(){
document.send_form.audience.disabled=true;
document.send_form.tech_1.disabled=false;
document.send_form.tech_2.disabled=false;
document.send_form.tech_3.disabled=false;
document.send_form.tech_4.disabled=false;
document.send_form.tech_5.disabled=false;
document.send_form.tech_6.disabled=false;
document.send_form.tech_7.disabled=false;
}

function enableGroups(){
document.send_form.audience.disabled=false;
document.send_form.tech_1.disabled=true;
document.send_form.tech_2.disabled=true;
document.send_form.tech_3.disabled=true;
document.send_form.tech_4.disabled=true;
document.send_form.tech_5.disabled=true;
document.send_form.tech_6.disabled=true;
document.send_form.tech_7.disabled=true;
}


function printDate(){
  today = new Date();
  mnt=today.getMonth()+1;
  day=today.getDate();
  if (mnt=="1"){month="January"}
  if (mnt=="2"){month="February"}
  if (mnt=="3"){month="March"}
  if (mnt=="4"){month="April"}
  if (mnt=="5"){month="May"}
  if (mnt=="6"){month="June"}
  if (mnt=="7"){month="July"}
  if (mnt=="8"){month="August"}
  if (mnt=="9"){month="September"}
  if (mnt=="10"){month="October"}
  if (mnt=="11"){month="November"}
  if (mnt=="12"){month="December"}
  if (day=="1"){end="st"}
  if (day=="2"){end="nd"}
  if (day=="3"){end="rd"}

  document.write(""+month+" "+day+", "+today.getYear());
}

function popwindow(address,width,height){
    var window_url = address;
    var window_name = "window_name";
    var window_features = "height="+height+",width="+width+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0,top=100,left=100";
	window.open(window_url,window_name,window_features);
}

function changeto(highlightcolor){
	source=event.srcElement
	if (source.tagName=="TR"||source.tagName=="TABLE")
	return
	while(source.tagName!="TD")
	source=source.parentElement
	if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
	source.style.backgroundColor=highlightcolor
}

function changeback(originalcolor){
	if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
	return
	if (event.toElement!=source)
	source.style.backgroundColor=originalcolor
}

 function CountDown()
 {
	warnTime = 60000 * 119;
	warnMe = setTimeout('RunDown()', warnTime);
 }

 function RunDown()
 {
	popwindow("../includes/expire_warning.php",260,120);
 }

 function Continue()
 {
 	self.close();
	opener.location.reload();
 }

 function LastMinute()
 {
 	closeMe = setTimeout('EndNow()', 60000);
 }

 function EndNow()
 {
 	self.close();
	opener.location = "../index.php?action=do_logout&auto=1";
 }
 
 
 // below here is the date picker code... hate putting all that html in it, but what the heck it was free right?

 
// Title: Timestamp picker
// Description: See the demo at url
// URL: http://us.geocities.com/tspicker/
// Script featured on: http://javascriptkit.com/script/script2/timestamp.shtml
// Version: 1.0
// Date: 12-05-2001 (mm-dd-yyyy)
// Author: Denis Gritcyuk <denis@softcomplex.com>; <tspicker@yahoo.com>
// Notes: Permission given to use this script in any kind of applications if
//    header lines are left unchanged. Feel free to contact the author
//    for feature requests and/or donations

function show_calendar(str_target, str_datetime) {

	var arr_months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
	var week_days = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
	var n_weekstart = 1; // day week starts from (normally 0 or 1)

	var dt_datetime = (str_datetime == null || str_datetime =="" ?  new Date() : str2dt(str_datetime));
	var dt_prev_month = new Date(dt_datetime);
	dt_prev_month.setMonth(dt_datetime.getMonth()-1);
	var dt_next_month = new Date(dt_datetime);
	dt_next_month.setMonth(dt_datetime.getMonth()+1);
	var dt_firstday = new Date(dt_datetime);
	dt_firstday.setDate(1);
	dt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7);
	var dt_lastday = new Date(dt_next_month);
	dt_lastday.setDate(0);
	
	// html generation (feel free to tune it for your particular application)
	// print calendar header
	var str_buffer = new String (
		"<html>\n"+
		"<head>\n"+
		"	<title>Calendar</title>\n"+
		"</head>\n"+
		"<body bgcolor=\"White\">\n"+
		"<table class=\"clsOTable\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n"+
		"<tr><td bgcolor=\"#4682B4\">\n"+
		"<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\">\n"+
		"<tr>\n	<td bgcolor=\"#4682B4\"><a href=\"javascript:window.opener.show_calendar('"+
		str_target+"', '"+ dt2dtstr(dt_prev_month)+"'+document.cal.time.value);\">"+
		"<img src=\"img/prev.gif\" width=\"16\" height=\"16\" border=\"0\""+
		" alt=\"previous month\"></a></td>\n"+
		"	<td bgcolor=\"#4682B4\" colspan=\"5\">"+
		"<font color=\"white\" face=\"tahoma, verdana\" size=\"2\">"
		+arr_months[dt_datetime.getMonth()]+" "+dt_datetime.getFullYear()+"</font></td>\n"+
		"	<td bgcolor=\"#4682B4\" align=\"right\"><a href=\"javascript:window.opener.show_calendar('"
		+str_target+"', '"+dt2dtstr(dt_next_month)+"'+document.cal.time.value);\">"+
		"<img src=\"img/next.gif\" width=\"16\" height=\"16\" border=\"0\""+
		" alt=\"next month\"></a></td>\n</tr>\n"
	);

	var dt_current_day = new Date(dt_firstday);
	// print weekdays titles
	str_buffer += "<tr>\n";
	for (var n=0; n<7; n++)
		str_buffer += "	<td bgcolor=\"#87CEFA\">"+
		"<font color=\"white\" face=\"tahoma, verdana\" size=\"2\">"+
		week_days[(n_weekstart+n)%7]+"</font></td>\n";
	// print calendar table
	str_buffer += "</tr>\n";
	while (dt_current_day.getMonth() == dt_datetime.getMonth() ||
		dt_current_day.getMonth() == dt_firstday.getMonth()) {
		// print row heder
		str_buffer += "<tr>\n";
		for (var n_current_wday=0; n_current_wday<7; n_current_wday++) {
				if (dt_current_day.getDate() == dt_datetime.getDate() &&
					dt_current_day.getMonth() == dt_datetime.getMonth())
					// print current date
					str_buffer += "	<td bgcolor=\"#FFB6C1\" align=\"right\">";
				else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
					// weekend days
					str_buffer += "	<td bgcolor=\"#DBEAF5\" align=\"right\">";
				else
					// print working days of current month
					str_buffer += "	<td bgcolor=\"white\" align=\"right\">";

				if (dt_current_day.getMonth() == dt_datetime.getMonth())
					// print days of current month
					str_buffer += "<a href=\"javascript:window.opener."+str_target+
					".value='"+dt2dtstr(dt_current_day)+"'+document.cal.time.value; window.close();\">"+
					"<font color=\"black\" face=\"tahoma, verdana\" size=\"2\">";
				else 
					// print days of other months
					str_buffer += "<a href=\"javascript:window.opener."+str_target+
					".value='"+dt2dtstr(dt_current_day)+"'+document.cal.time.value; window.close();\">"+
					"<font color=\"gray\" face=\"tahoma, verdana\" size=\"2\">";
				str_buffer += dt_current_day.getDate()+"</font></a></td>\n";
				dt_current_day.setDate(dt_current_day.getDate()+1);
		}
		// print row footer
		str_buffer += "</tr>\n";
	}
	// print calendar footer
	str_buffer +=
		"<form name=\"cal\">\n<tr><td colspan=\"7\" bgcolor=\"#87CEFA\">"+
		"<font color=\"White\" face=\"tahoma, verdana\" size=\"2\">"+
		"Time: <input type=\"text\" name=\"time\" value=\""+dt2tmstr(dt_datetime)+
		"\" size=\"8\" maxlength=\"8\"></font></td></tr>\n</form>\n" +
		"</table>\n" +
		"</tr>\n</td>\n</table>\n" +
		"</body>\n" +
		"</html>\n";

	var vWinCal = window.open("", "Calendar", 
		"width=200,height=250,status=no,resizable=yes,top=200,left=200");
	vWinCal.opener = self;
	var calc_doc = vWinCal.document;
	calc_doc.write (str_buffer);
	calc_doc.close();
}
// datetime parsing and formatting routimes. modify them if you wish other datetime format
function str2dt (str_datetime) {
	var re_date = /^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)$/;
	if (!re_date.exec(str_datetime))
		return alert("Invalid Datetime format: "+ str_datetime);
	return (new Date (RegExp.$3, RegExp.$2-1, RegExp.$1, RegExp.$4, RegExp.$5, RegExp.$6));
}
function dt2dtstr (dt_datetime) {
	return (new String (
			// dt_datetime.getFullYear()+"-"+(dt_datetime.getMonth()+1)+"-"+dt_datetime.getDate()+" "));
			dt_datetime.getDate()+"-"+(dt_datetime.getMonth()+1)+"-"+dt_datetime.getFullYear()+" "));
}
function dt2tmstr (dt_datetime) {
	return (new String (
			dt_datetime.getHours()+":"+dt_datetime.getMinutes()+":"+dt_datetime.getSeconds()));
}

function othercheck(){
	if (document.content_form.vendor_id.options[document.content_form.vendor_id.selectedIndex].value == "other"){
		document.getElementById("other").style.visibility = "visible";
		document.content_form.vendor_other.disabled = false;
		document.content_form.vendor_other.style.visibility = "visible";
		
	}
	else {
		document.getElementById("other").style.visibility = "hidden";
		document.content_form.vendor_other.disabled = true;
		document.content_form.vendor_other.style.visibility = "hidden";
	}
}

function FileRemoveCheck(name) {
	var message = "Are you sure you want to remove this file?";
	
	switch(name){
		case "tear_sheet":
			if (document.content_form.remove_tear_sheet.checked){
				if (!confirm(message)){
					document.content_form.remove_tear_sheet.checked	= false;
				}
			}
		break;
		
		case "main_photo":
			if (document.content_form.remove_main_photo.checked){
				if (!confirm(message)){
					document.content_form.remove_main_photo.checked = false;
				}
			}
		break;
		
		case "pfile1":
			if (document.content_form.remove_pfile1.checked){
				if (!confirm(message)){
					document.content_form.remove_pfile1.checked = false;
				}
			}
		break;
		
		case "pfile2":
			if (document.content_form.remove_pfile2.checked){
				if (!confirm(message)){
					document.content_form.remove_pfile2.checked = false;
				}
			}
		break;
		
		case "pfile3":
			if (document.content_form.remove_pfile3.checked){
				if (!confirm(message)){
					document.content_form.remove_pfile3.checked = false;
				}
			}
		break;
		
		case "pfile4":
			if (document.content_form.remove_pfile4.checked){
				if (!confirm(message)){
					document.content_form.remove_pfile4.checked = false;
				}
			}
		break;
		
		case "article":
			if (document.content_form.remove_article.checked){
				if (!confirm(message)){
					document.content_form.remove_article.checked	= false;
				}
			}
		break;
		
	}
	
}

function clearemail() {
	if (document.basic_email.email.value == "enter email"){
	document.basic_email.email.value = "";
	}
}


/*   DROP DIDDY's BELOW-----------------------------------------------------------------------*/
/*   DROP DIDDY's-----------------------------------------------------------------------*/
/*   DROP DIDDY's-----------------------------------------------------------------------*/
/*   DROP DIDDY's-----------------------------------------------------------------------*/

//Chrome Drop Down Menu- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated: June 14th, 06'

//Chrome Drop Down Menu- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated: June 14th, 06'

var cssdropdown={
disappeardelay: 50, //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: false, //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

//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,

getposOffset:function(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;
},

swipeeffect:function(){
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)"
}
else
return
this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
},

showhide:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || 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=0
this.swipeeffect()
}
obj.visibility="visible"
}
else if (e.type=="click")
obj.visibility="hidden"
},

iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},

clearbrowseredge:function(obj, whichedge){
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
},

dropit:function(obj, e, dropmenuID){
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(){return !cssdropdown.disablemenuclick} //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"
}
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
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()
},

delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'",this.disappeardelay) //hide menu
},

clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
},

startchrome:function(){
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"))
}
}
}
}
}

}
/*    FLASH SNIFFER------------------------------------------------*/
/**
 * SWFObject v1.4.2: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){_16.push(key+"="+_18[key]);}
return _16;
},getSWFHTML:function(){
var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=key+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}
_19+="/>";
}else{if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}
_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();
return true;
}else{
if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{
try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e){try{
var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_23=new deconcept.PlayerVersion([6,0,21]);
axo.AllowScriptAccess="always";}
catch(e){
if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}
if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return _23;};
deconcept.PlayerVersion=function(_27){
this.major=_27[0]!=null?parseInt(_27[0]):0;
this.minor=_27[1]!=null?parseInt(_27[1]):0;
this.rev=_27[2]!=null?parseInt(_27[2]):0;
};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){return false;}
return true;
};
deconcept.util={getRequestParameter:function(_29){
var q=document.location.search||document.location.hash;
if(q){
var _2b=q.substring(1).split("&");
for(var i=0;i<_2b.length;i++){
if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){
var _2d=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2d.length;i++){
_2d[i].style.display="none";
for(var x in _2d[i]){if(typeof _2d[i][x]=="function"){_2d[i][x]=null;}}}};
if(typeof window.onunload=="function"){
var oldunload=window.onunload;
window.onunload=function(){
deconcept.SWFObjectUtil.cleanupSWFs();
oldunload();};
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}
if(Array.prototype.push==null){
Array.prototype.push=function(_30){
this[this.length]=_30;
return this.length;};}

var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject; // for legacy support
var SWFObject=deconcept.SWFObject;

/*ROLLOVER DIZZ____________________________________*/
function setupRollovers() {
if (!document.getElementsByTagName)
return;
var all_links = document.getElementsByTagName('a');
for (var i = 0; i < all_links.length; i++) {
var link = all_links[i];
if (link.className &&
(' ' + link.className + ' ').indexOf(' rollover ') != -1)
{
if (link.childNodes &&
link.childNodes.length == 1 &&
link.childNodes[0].nodeName.toLowerCase() == 'img') {
link.onmouseover = mouseover;
link.onmouseout = mouseout;
}
}
}
}
function findTarget(e)
{
/* Begin the DOM events part, which you */
/* can ignore for now if it's confusing */
var target;
if (window.event && window.event.srcElement)
target = window.event.srcElement;
else if (e && e.target)
target = e.target;
if (!target)
return null;
while (target != document.body &&
target.nodeName.toLowerCase() != 'a')
target = target.parentNode;
if (target.nodeName.toLowerCase() != 'a')
return null;
return target;
}
function mouseover(e) {
var target = findTarget(e);
if (!target) return;
// the only child node of the a-tag in target will be an img-tag
var img_tag = target.childNodes[0];
// Take the "src", which names an image called "something.ext",
// Make it point to "something_over.ext"
// This is done with a regular expression
img_tag.src = img_tag.src.replace(/(\.[^.]+)$/, '-over$1');
}
function mouseout(e) {
var target = findTarget(e);
if (!target) return;
// the only child node of the a-tag in target will be an img-tag
var img_tag = target.childNodes[0];
// Take the "src", which names an image as "something_over.ext",
// Make it point to "something.ext"
// This is done with a regular expression
img_tag.src = img_tag.src.replace(/-over(\.[^.]+)$/, '$1');
}
// When the page loads, set up the rollovers
window.onload = setupRollovers;

