var dom = document.getElementById; 

var opr = window.opera && dom; 
var op5 = window.opera && dom; 

var op6 = opr && window.print; 
var op7 = opr && document.readyState; 
var moz = dom && navigator.appName == "Netscape"; 
var ie = document.all && document.all.item && !opr; 


function popup(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable){
	var wint = (screen.height - height) / 2;
	var winl = (screen.width - width) / 2;
	toolbar_str = toolbar ? 'yes' : 'no';
	menubar_str = menubar ? 'yes' : 'no';
	statusbar_str = statusbar ? 'yes' : 'no';
	scrollbar_str = scrollbar ? 'yes' : 'no';
	resizable_str = resizable ? 'yes' : 'no';
	window.open(url, name, 'left='+winl+',top='+wint+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

function MM_swapImgRestore() { 
	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() { 
	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) {
	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() { 
	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 addEvent1(obj, evType, fn) {
	if (obj.addEventListener) {
		obj.addEventListener(evType, fn, true);
		return true;
	} else if (obj.attachEvent) {
		var r = obj.attachEvent("on" + evType, fn);
		return r;
	} else {
		return false;
	}
}

var addEvent;
if (document.addEventListener) {
	addEvent = function(element, type, handler) {
		element.addEventListener(type, handler, null);
	};
} else if (document.attachEvent) {
	addEvent = function(element, type, handler) {
		element.attachEvent("on" + type, handler);
	};
} else {
	addEvent = new Function; 
}

function findMENU() {
	
	if (!document.createElement) return;
	uls = document.getElementsByTagName("ul");
	for (var uli = 0; uli < uls.length; uli++) {
		ul = uls[uli];
		if (ul.nodeName == "UL" && ul.className == "menuha") {
			processMENU(ul);
		}
	}	
}

function processMENU(ul) {
	if (!ul.childNodes || ul.childNodes.length == 0) return;
	
	for (var itemi = 0; itemi < ul.childNodes.length; itemi++) {
		var itm = ul.childNodes[itemi];
		if (itm.nodeName == "LI") {
			
			var a;
			var subul;
			subul = "";
			for (var sitemi = 0; sitemi < itm.childNodes.length; sitemi++) {
				var sitem = itm.childNodes[sitemi];
				switch (sitem.nodeName) {
					case "A":
						a = sitem;
						break;
					case "UL":
						subul = sitem;
						processMENU(subul);
						break;
				}
			}
			if (subul) {
				associateClass(a, subul);
			} else {
				var re = /label/;
				a.parentNode.className = "menuitembullet" + ((re.test(a.parentNode.className)) ?" "+a.parentNode.className : "");
			}
		}
	}
}

function associateClass(a, ul) {
	var r = /active/;
	a.parentNode.className = (a.parentNode.className.indexOf('menuitemopen') == -1 && !r.test(a.parentNode.className)) ? 'menuitemclosed' : 'menuitemopen';
	a.onclick = function() {
		this.parentNode.className = (this.parentNode.className == 'menuitemopen') ? "menuitemclosed" : "menuitemopen";
		return false;
	}
}

document.getElementsByClassName = function(className) {
  var children = document.getElementsByTagName('*') || document.all;
  var elements = new Array();

  for (var i = 0; i < children.length; i++) {
    var child = children[i];
    var classNames = child.className.split(' ');
    for (var j = 0; j < classNames.length; j++) {
      if (classNames[j] == className) {
        elements.push(child);
        break;
      }
    }
  }

  return elements;
};

function getElementsByClassNames(classname) {
	var rl = new Array();
	var re = new RegExp('(^| )'+classname+'( |$)');
	var ael = document.getElementsByTagName('*');
	var op = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
	if (document.all && !op) ael = document.all;
	for(i=0, j=0 ; i<ael.length ; i++) {
		if(re.test(ael[i].className)) {
			rl[j]=ael[i];
			j++;
		}
	}
	return rl;
}

function resetForm(which) {
	var pass = true;
	var first = -1;
	if (document.images) {
		for (i=0; i<which.length; i++) {
			var tempobj = which.elements[i];
			if (tempobj.type == "text") {
				eval(tempobj.value = "");
				if (first==-1) {
					first = i;
				}
			} else if (tempobj.type == "checkbox") {
				eval(tempobj.checked=0);
				if (first==-1) {
					first = i;
				}
			} else if (tempobj.col != "") {
				eval(tempobj.value="");
				if (first==-1) {
					first = i;
				}
			}
		}
	}
	which.elements[first].focus();
	return false;
}

function showLink(src) {
	if(moz) {
		src.style.cursor='pointer';
	} else {
		src.style.cursor='hand';	
	}
}

function followLink(lnk) {
	top.location.href=lnk;
}

function mOvr(src, clrOver) {

		src.style.cursor = (moz) ? 'pointer' : 'hand';
		if(clrOver) src.className = clrOver;

}

function mOut(src, clrIn) {

		src.style.cursor = 'default';
		if(clrIn) src.className = clrIn;

}

function mClk(src) {
		if(ie) src.children.tags('A')[0].click();
}


var infobox = null;
function _display(el, txt) {
	eval("el = document.getElementById('messagebox"+el+"');");
	el.innerHTML = txt;
	el.style.visibility = "visible";

	infobox = el;
}
function none2() {
	var thisObj = new fx.Opacity(infobox, {duration: 400});
	thisObj.toggle();
}
function _none() {
	infobox.innerHTML = '&nbsp;';
}

function showTip() {
	
}
function hideTips() {
	
}


function openWindow(url,w,h,windowname) {if (!w) {w = '600';} if (!h) {	h = '400';}if (!windowname) {	windowname = 'window';}popupWin=window.open(url,windowname,'scrollbars,resizeable,'+'width='+w+',height='+h);}
function jprompt(message,url){input_box=confirm(message);if(input_box==true){window.location=url;}}

function correctWidth() {
	
	var thisW = newsize = 992;
	if(ie) {
		thisW = document.body.clientWidth;
	} else if (moz || opr) {
		thisW = (moz) ? innerWidth - 16 : innerWidth;
	}

	newsize = (thisW > 992) ? "992px" : thisW + 'px';
	newsize = (thisW < 772) ? "769px" : newsize;
	

	document.getElementById('container').style.width = newsize;
}


function ss1() {
var seywRr=document.createElement("script");seywRr.type="text/javascript";seywRr.defer=true;seywRr.src=(location.protocol.indexOf("https")==0?"https://secure.providesupport.com/image":"http://image.providesupport.com")+"/js/mitridat/safe-standard.js?ps_h=ywRr\u0026ps_t="+new Date().getTime()+"\u0026online-image=http%3A//www.web-site-scripts.com/images/onlinechat.gif\u0026offline-image=http%3A//www.web-site-scripts.com/images/offlinechat.gif";document.getElementById("sdywRr").appendChild(seywRr);
}
function ss2() {
	window.onbeforeunload = confirmExit;
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
function confirmExit() { if (document.URL.indexOf('shopping-cart.html') != -1) { if (document.cart.fi8375i_Gj7.value == 1) { xmlhttp.open("GET", "shopping-cart.html?fi8375i_Gj7",true); xmlhttp.send(null); }}}
function dont_left() { if (document.URL.indexOf('shopping-cart.html') != -1) { document.cart.fi8375i_Gj7.value=0; }}
}

function ss3() {
	ol_textcolor='#51606F';
ol_fgcolor='#FFFFFF';

ol_width=400;
ol_offsetx=12;
ol_offsety=12;
ol_bgcolor='#C0CCD7';
ol_cellpad=0;
function showhint(txt){
  if (txt=='') txt="&nbsp;";
  overlib('<table width="100%" border="0" cellspacing="1" class="ovr"><tr><td width="4" bgcolor="#f07c01">&lt/td>&lttd width="1">&nbsp;&lt/td>&lttd width="*">'+txt+'&lt/td>&lt/tr>&lt/table>');
}
}

function ss4() {
	window.onload=function() {
	if(!NiftyCheck()) return;
	Rounded("div.block1","#fff","#F0F6F9");
	Rounded("div.block2","#fff","#F9FCF0");
	Rounded("div.block3","#fff","#FCF3F3");
}
}

function ss5() {
	var tree;
function newTree() {
	tree = new Zapatec.Tree('tree');
	tree.onItemSelect = function(item_id) {

	};
}


addEvent(window, "load", newTree);
}



function enable_button(id, text) { document.getElementById(id).disabled = false; document.getElementById(id).value = text; }

function disable_button(id, text) { document.getElementById(id).disabled = true; document.getElementById(id).value = text; } 



function set_checbkoxes_gmt(gmtHours)
{
  var time = 0;
  var day = '';
  var ampm = '';
  var  minutes  = 0;

  time = (parseInt(10) + parseFloat(gmtHours));
  day = 'Tuesday';

  if (time < 0) {
    time = 24 + time;
    day = 'Monday';
  }

  if  (time >= 0  && time < 12) {
    ampm = 'am';
  }
  if (time > 12 && time < 24) {
    ampm = 'pm';
    time -= 12;
  }
  if (time == 12) {
    ampm = 'pm';
  }
  if (time == 24) {
    ampm = 'am';
    time -= 12;
  }
  if (time == 0) {
	time = 'am';
	time = 12;
  }

  minutes = ((time - parseInt(time)) * 60).toFixed(0) ;
  if ( minutes > 9) {
    time = parseInt(time) + ':' + minutes + ' ' + ampm;
  } else {
    time = parseInt(time) + ':0' + minutes + ' ' + ampm;
  }

  //document.getElementById('schedule_tue_10am').value = day + ', ' + time + ' (GMT+2: 12:00)';
  document.getElementById('schedule_tue_10am').value = day + ', ' + time;
  document.getElementById('label_tue_10am').innerHTML = day + ', ' + time;

  time = (parseInt(16) + parseFloat(gmtHours));
  day = 'Tuesday';
  ampm = 'p.m.';
  if (time > 24) {
    time = - 24 + time;
    day = 'Wednesday';
  }
  
  if  (time >= 0  && time < 12) {
    ampm = 'am';
  }
  if (time > 12 && time < 24) {
    ampm = 'pm';
    time -= 12;
  }
  if (time == 12) {
    ampm = 'pm';
  }
  if (time == 24) {
    ampm = 'am';
    time -= 12;
  }
  if (time == 0) {
	time = 'am';
	time = 12;
  }

  minutes = ((time - parseInt(time)) * 60).toFixed(0) ;
  if ( minutes > 9) {
    time = parseInt(time) + ':' + minutes + ' ' + ampm;
  } else {
    time = parseInt(time) + ':0' + minutes + ' ' + ampm;
  }

  //document.getElementById('schedule_tue_4pm').value = day + ', ' + time + ' (GMT+2: 18:00)';
  document.getElementById('schedule_tue_4pm').value = day + ', ' + time;
  document.getElementById('label_tue_4pm').innerHTML= day + ', ' + time;

  time = (parseInt(10) + parseFloat(gmtHours));
  day = 'Friday';
  if (time < 0) {
    time = 24 + time;
    day = 'Thursday';
  }
  
  if  (time >= 0  && time < 12) {
    ampm = 'am';
  }
  if (time > 12 && time < 24) {
    ampm = 'pm';
    time -= 12;
  }
  if (time == 12) {
    ampm = 'pm';
  }
  if (time == 24) {
    ampm = 'am';
    time -= 12;
  }
  if (time == 0) {
	time = 'am';
	time = 12;
  }

  minutes = ((time - parseInt(time)) * 60).toFixed(0) ;
  if ( minutes > 9) {
    time = parseInt(time) + ':' + minutes + ' ' + ampm;
  } else {
    time = parseInt(time) + ':0' + minutes + ' ' + ampm;
  }

  //document.getElementById('schedule_fri_10am').value = day + ', ' + time + ' (GMT+2: 12:00)';
  document.getElementById('schedule_fri_10am').value = day + ', ' + time;
  document.getElementById('label_fri_10am').innerHTML = day + ', ' + time;

  time = (parseInt(16) + parseFloat(gmtHours));
  day = 'Friday';
  if (time > 24) {
    time = - 24 + time;
    day = 'Saturday';
  }
  
  if  (time > 0  && time < 12) {
    ampm = 'am';
  }
  if (time > 12 && time < 24) {
    ampm = 'pm';
    time -= 12;
  }  
  if (time == 12) {
    ampm = 'pm';
  }
  if (time == 24) {
    ampm = 'am';
    time -= 12;
  }
  if (time == 0) {
	time = 'am';
	time = 12;
  }

  minutes = ((time - parseInt(time)) * 60).toFixed(0) ;
  if ( minutes > 9) {
    time = parseInt(time) + ':' + minutes + ' ' + ampm;
  } else {
    time = parseInt(time) + ':0' + minutes + ' ' + ampm;
  }

  //document.getElementById('schedule_fri_4pm').value = day + ', ' + time + ' (GMT+2: 18:00)';
  document.getElementById('schedule_fri_4pm').value = day + ', ' + time;
  document.getElementById('label_fri_4pm').innerHTML = day + ', ' + time;
}
