// JavaScript Document
<!--
var total_items=0;
var t;
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 ShowNext(start,idVal,idHide){
	d_hide(idHide);
}
function d_out(id,id2){
	//alert(document.getElementById(id).style.visible);
	//if(document.getElementById(id).style.display=="block"){
		effect_1 = Effect.SlideUp(id,{duration:1.0}); 
		t=setTimeout("d_in('"+id2+"')",1200);
	//}else d_in(id2);
	return false;
}
function validateJob(){
	return true;
}
function changeColor(o){
	o.style.color="#603913";
}
function changeColorBack(o){
	o.style.color="#a1a1a1";
}
function GoToPage(o){
	window.location.href=o.options[o.selectedIndex].value;
}
function ShowDiv(id){
	effect_1 = Effect.SlideDown(id,{duration:0.5}); 
	//document.getElementById(id).style.display="block";
}
function HideDiv(id){
	if(document.getElementById(id).mouseover) alert("fgd");
}
function FillEditForm(id, pos){	
	//alert(document.getElementById(pos+"title").value);
	document.getElementById(pos+"title").value = "WEWE";
	document.getElementById(pos+"title").value = document.getElementById(id+"_title").innerHTML;
	document.getElementById(pos+"content").value = document.getElementById(id+"_content").innerHTML;
	document.getElementById(pos+"pid").value = id;
	
	document.getElementById("Ltitle").value="gfhfghgh";
	alert(document.getElementById("Ltitle").value);
}
function confirmdelete(id,pid){
	var c= confirm("Are you sure you want to delete this item?");
	if(c)	window.location="column_del.php?id="+pid+"&del="+id;
}
function confirmSPdelete(id,del){
	var c= confirm("Are you sure you want to delete this Sub Page?");
	if(c)	window.location="subpage_del.php?id="+id+"&del="+del;
}
function ShowHideLink(x,y){
	if(document.getElementById(y).innerHTML=="[-] Collapse Sub Pages Panel"){
		d_hide(x);
		document.getElementById(y).innerHTML="[+] Expand Sub Pages Panel";
	}
	else{
		show(x);
		document.getElementById(y).innerHTML="[-] Collapse Sub Pages Panel";	
	}
}
function SH(o){
	if(o.checked==true && o.id=="tosp"){
		document.getElementById("id_selsp").style.display="block";
		document.getElementById("id_selfile").style.display="none";
	}
	else{
		document.getElementById("id_selsp").style.display="none";
		document.getElementById("id_selfile").style.display="block";
	}
}
function SHBT(o){
	if(o.checked==true && o.id=="tospR"){
		document.getElementById("id_selspR").style.display="block";
		document.getElementById("id_selfileR").style.display="none";
	}
	else{
		document.getElementById("id_selspR").style.display="none";
		document.getElementById("id_selfileR").style.display="block";
	}
}
function SHB(o,x,y){
	if(o.checked==true){
		document.getElementById(x).style.display="block";
		document.getElementById(y).style.display="none";
	}
	else{
		document.getElementById(y).style.display="block";
		document.getElementById(x).style.display="none";
	}
}
function trim (str) {
	var whitespace = ' \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000';
	for (var i = 0; i < str.length; i++) {
		if (whitespace.indexOf(str.charAt(i)) === -1) {
			str = str.substring(i);
			break;
		}
	}
	for (i = str.length - 1; i >= 0; i--) {
		if (whitespace.indexOf(str.charAt(i)) === -1) {
			str = str.substring(0, i + 1);
			break;
		}
	}
	return whitespace.indexOf(str.charAt(0)) === -1 ? str : '';
}
function SendLoginRequest(){	
	id="content";
	if(trim(document.getElementById("tpips").value)==""){
		document.getElementById("warning").innerHTML="Please enter your username";
		return false;
	}
	if(trim(document.getElementById("tpips").value).length<5){
			document.getElementById("warning").innerHTML="Your username is too short";
		return false;
	}
	if(trim(document.getElementById("stips").value)==""){
		document.getElementById("warning").innerHTML="Please enter your password";
		return false;
	}
	if(trim(document.getElementById("stips").value).length<5){
		document.getElementById("warning").innerHTML="Your password is too short";
		return false;
	}
	effect_1 = Effect.SwitchOff(id,{duration:0.2});
	t=setTimeout("rtrue()",9000);
	//return true;
}
function rtrue(){
	return true;
}
function HideGo(id,lnk){
	d_hide(id);
	t=setTimeout("getURL('"+lnk+"')",900);
}
function getURL(s){
	window.location.href=s;
}
function chkpwd(){
	if(document.getElementById("tp_pass").value==""){
		alert("Please supply a password");
		return false;
	}
	return true;
}
function validateUser(){
	if(document.getElementById("bb_pass").value==""){
		alert("Please supply a password");
		return false;
	}
	return true;
}
function SquareIn(id){
	effect_1 = Effect.Appear(id,{duration:1.0}); return false;
}
function PuffOut(id){
	effect_1 = Effect.SwitchOff(id,{duration:0.2}); return false;
}
function PuffIn(id){
	effect_1 = Effect.Appear(id,{duration:0.2}); return false;
}
function d_in(id){
	  effect_1 = Effect.SlideDown(id,{duration:1.0}); return false;
	  clearTimeout(t);
}
function d_hide(id){
	  effect_1 = Effect.SlideUp(id,{duration:0.6}); return false;
	  clearTimeout(t);//if timeoutg
}
function ShowObject(id){
  	d_in(id);
}
function ShowObjects(ida,idb){
	d_in(ida);
	t=setTimeout("d_in('"+idb+"')",800);
}
function HideObject(id){
  	d_hide(id);
	t=setTimeout("d_hide('"+idb+"')",800);
}
function HideObjectTimed(id){
	t=setTimeout("PuffOut('"+id+"')",3200);
}
function Hide3Objects(a,b,c){
  	d_hide(a);
	t=setTimeout("d_hide('"+b+"')",800);
	t2=setTimeout("d_hide('"+c+"')",1600);
}
function Hide2Objects(a,b,c){
  	d_hide(a);
	t=setTimeout("d_hide('"+b+"')",800);
	t2=setTimeout("ShowObject('"+c+"')",1600);
}
function Show2Objects(a,b,c){
  	d_hide(a);
	t=setTimeout("ShowObject('"+b+"')",800);
	t2=setTimeout("ShowObject('"+c+"')",1600);
}
function ShowHide(din,out){
	  clearTimeout(t);
	  var _out,_in;
	  d_out(out,din);
}
function ShowHideEdit(din,out,id){
	document.getElementById("div_theEditor_"+id).innerHTML=document.getElementById("div_editor").innerHTML;
	document.getElementById("div_theEditor_"+id).style.display="block";
	clearTimeout(t);
	var _out,_in;
	d_out(out,din);
	
}
function SwitchButtons(a,b){
	document.getElementById(a).style.display="none";
	document.getElementById(b).style.display="block";
}
function HideBtnsNShowHideDiv(d1,d2,b1,b2){
	document.getElementById(b1).style.display="none";
	document.getElementById(b2).style.display="block";
	ShowHide(d1,d2);
}

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;
}
var lastcolor="";
function mover(o){
	lastcolor = o.style.backgroundColor;
	o.style.backgroundColor="#9F7D06";
}
function mout(o){
	o.style.backgroundColor=lastcolor;
}
function show(id){
	//document.getElementById(id).style.display="block";
	ShowObject(id);
}
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 isCurrentPage(txt, path){
	if(document.URL.match(path))
		return ("<font color='#ec008c'>"+txt+"</font>");
	else return txt;
}
function LinkColorPink(obj){obj.style.color="#ec008c";}
function LinkColorWhite(obj){obj.style.color="#FFFFFF";}
function LinkColorGrey(obj){obj.style.color="#a1a1a1";}
function CaptureType(obj,productid){
	eraseCookie(productid);
	createCookie(productid,obj.options[obj.selectedIndex].text,.2);
	//alert(readCookie(productid));
}


/*************************************************************************************************/
//						_AJAX Styles Class                                               /
//						This class is used for a client-side formating of AJAX elements           /
//				                                                                                  /
//						Written Tuesday, April 14, 2008                                           /
//						By Cornelius Moore (cornz24@yahoo.com)                                    /
/*************************************************************************************************/

/* Superclass and main constructor */
function _AJAX(){}

/***********************************************************************************************
					All subclasses of _AJAX  are defined here
************************************************************************************************/
function eObjects(){
	this.superclass();
	this.processor;
	this.isWorking = false;
	this.isAsync = true;
	
	eObjects.prototype.createXmlHttpObject = function(){
		var o;
		if(window.xmlhttpRequest && !(window.ActiveXObject)){
			try{
				o = new oRequest();
			}catch(e){	o = false;}		
		}else if(window.ActiveXObject){
			try{
				o = new ActiveXObject("Msxml2.xmlhttp");
			}catch(e){
				try{
					o = new ActiveXObject("Microsoft.xmlhttp");
				}catch(e){ o = false;}
			}
		}
		return o;
	};
	
	eObjects.prototype.SendXmlHttpRequest = function(obj,qstr,fnc){
	eObjects.processor=fnc;
		if (!this.isWorking && obj) {
			obj.open("POST", qstr, this.isAsync);
			obj.onreadystatechange = function(){
				if (obj.readyState == 4){		
					if (obj.responseText.indexOf('invalid') == -1) {
						r = obj.responseText;
						var p=fnc(obj.responseText);						
					}
				}	
			}	
			obj.send('');
		}
	};
	
	eObjects.prototype.SendXmlHttpRequestPost = function(obj,url,qstr,fnc){
		eObjects.processor=fnc;
		if (!this.isWorking && obj) {
			obj.open("POST", url, this.isAsync);
			//obj.send(qstr);
			
			obj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			obj.setRequestHeader("Content-length", qstr.length);
			obj.setRequestHeader("Connection", "close");
			
			obj.onreadystatechange = function(){
				if (obj.readyState == 4){		
					if (obj.responseText.indexOf('invalid') == -1) {
						r = obj.responseText;
						var p=fnc(obj.responseText);						
					}
				}	
			}	
			obj.send(qstr);
		}
	};
	
	eObjects.prototype.DestroyXmlHttpObject = function(obj){
	    if(obj != null)
		    delete obj;		
	};
}

eObjects.prototype = new _AJAX();
eObjects.prototype.contructor = eObjects;
eObjects.prototype.superclass = _AJAX;
eObjects = new eObjects();

_AJAX=new _AJAX();


function ordermailresponse(r){
	alert(r);
	//document.write(r);
}

/*  *******************************  COOKIES**************************/
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
/*************************************** END COOKIES *******************************/

function FormValidation() {    
	if(document.getElementById('product_avail')){
	    if(document.getElementById('product_avail').value == 0) {
    	    alert("Out of stock");
        	return false;
	    }
	}
	if(document.getElementById('otherOptions')){
	    if(document.getElementById('otherOptions').selectedIndex == 0) {
    	    alert("Please select an item");
			document.getElementById('otherOptions').focus();
        	return false;
	    }
	}
    return true;
}
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: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			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();

function submitMyForm(){
	var _form=document.getElementById("orderform");
	if(BrowserDetect.version=="6"){
		//alert("2temp");
		document.orderform.submit()
		//document.URL='/xcart/cart.php?mode=add';
		//document.URL='/xcart/cart.php?mode=add';
		//window.location.href='/xcart/cart.php?mode=add';
		return true;
		//location.href="/xcart/cart.php?mode=add";
	}
	else{
		_form.submit();
		if(document.orderform)	document.orderform.submit();
	}
}


-->
