<!--
// popup() function: 
// <a href="javascript:;" onClick="javascript:popup('name', '#link', 0, 0, 300, 150, 0, 0, 1, 1, 1); return false;"></a>
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() { //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];
	}
}

function urlencode(ch) {
//	ch = ch.replace(/[ ]/g,"+")
	ch = ch.replace(/[ ]/g,"%20")
	return escape(ch)
}
function urldecode(ch) {
   ch = ch.replace(/[+]/g," ")
   return unescape(ch)
}

function popupimg(name, url, width, height){
	var imgss;
	winl = (screen.width) ? (screen.width - width) / 2 : 0;
	wint = (screen.height) ? (screen.height - height) / 2 : 0;
	var winname = urlencode(name);
	var settings = 'left='+winl+',top='+wint+',width='+(width+40)+',height='+(height+40)+',toolbar=no,menubar=no,status=yes,scrollbars=yes,resizable=yes';
	myimgss = window.open('','imgpoint',settings);
	myimgss.document.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><title>'+urldecode(winname)+' // gallery @ sitename.com</title></head><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><table height="100%" width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle"><a href="javascript:self.close();"><img src="'+url+'" name="fullbimg" alt="Click to close the window..." width="'+width+'" height="'+height+'" border="0"></a></td></tr></table></body></html>');
	if(myimgss.window.focus) {
		myimgss.window.focus();
	}
}

function Dating(){
   var d, s = 'Today is: ';
   d = new Date();
   s += d.getDate() + "/";
   s += (d.getMonth() + 1) + "/";
   s += d.getYear();
   return(s);
}

function _LoadChanges(category, id) {
	var outHTML = '';
	var outLayer = '';
	var mainNav = '<center>';

	// new jshttpr obj
	var req = new Subsys_JsHttpRequest_Js();
	req.onreadystatechange = function() {
		if (req.readyState == 4) {
			if (req.responseJS) {
				// compile a monster navigation
				mainNav += (req.responseJS.previousid !== null) ? '<a href="javascript:;" onClick="_LoadChanges('+category+','+req.responseJS.previousid+');"><img src="/images/ico-prev.gif" alt="&lt;" title="&lt;" width="13" height="13" border="0" align="absmiddle"></a>' : '<img src="/images/1x1.gif" alt="" width="13" height="13" hspace="4" border="0" align="absmiddle">';
				mainNav += '<img src="/images/ico-more.gif" alt="more" title="" hspace="4" border="0" align="absmiddle">';
				mainNav += (req.responseJS.nextid !== null) ? '<a href="javascript:;" onClick="_LoadChanges('+category+','+req.responseJS.nextid+');"><img src="/images/ico-next.gif" alt="&gt;" title="&gt;" width="13" height="13" border="0" align="absmiddle"></a>' : '<img src="/images/1x1.gif" alt="" width="13" height="13" hspace="4" border="0" align="absmiddle">';
				mainNav +=  '</center>\n';				

				if(category && category == 1) { // block Testimonials
					outLayer = 'block_testimonials';
					outHTML += '<div class="title">Testimonials</div>\n'+mainNav;
					outHTML += '<p>'+req.responseJS.content+'</p>';
					outHTML += '<p align="right" style="font-style:italic">'+req.responseJS.label+'</p>';
				} else if (category && category == 2) { // block Awards
					outLayer = 'block_awards';
					outHTML += '<div class="titlemod"><div class="title modified">Awards</div>\n<div class="titleadd"><img src="/images/cup.png" alt="" width="37" height="46"></div>\n</div>\n<div class="bggg1" style="padding-top:10px">'+mainNav;
					outHTML += '<center><img src="'+req.responseJS.content+'" alt="" width="'+req.responseJS.width+'" height="'+req.responseJS.height+'" hspace="2" vspace="5" alt="'+req.responseJS.label+'" title="'+req.responseJS.label+'"></center>\n';
				} else if (category && category == 3) { // block Featured Client
					outLayer = 'block_featclient';
					outHTML += '';
					outHTML += '<div class="title">Featured Client</div>\n'+mainNav;
					outHTML += '\n<p><center><a href="'+req.responseJS.label+'" target="_blank" title="'+req.responseJS.label+'"><img src="'+req.responseJS.content+'" alt="'+req.responseJS.label+'" title="'+req.responseJS.label+'" width="'+req.responseJS.width+'" height="'+req.responseJS.height+'" hspace="2" vspace="5" border="0"></a></center>\n<br></p>';
				}
				if(outLayer !== '') { // writeLn
					document.getElementById(outLayer).style.display = 'block';
					document.getElementById(outLayer).innerHTML = outHTML;
				}
			}
			// debug info
			//alert(req.responseText);
			//document.getElementById('debug').innerHTML = req.responseText;
		}
	}
	// allow caching
	req.caching = true;
	// Prepare object
	req.open('POST', location.protocol+'//www.allecommerce.com/parse.php?random=true', true);
	// Send query
	req.send({ category: category, id:id });
}

// is_dom?
var dom = document.getElementById;

function getBase() {
	var base = '';
	baseCollection = document.getElementsByTagName('base');
	
	if ((baseCollection!=null) && (baseCollection.length > 0)) {
		base = baseCollection[0].href;
		//base = base.substring(0,base.lastIndexOf('/')+1);
		base = base.substring(0,base.lastIndexOf('/'));		
	}
	return(base);
}

function ChangeActiveMenuItem() {
	if(dom) {
		// search for menu column
		var leftColumn = document.getElementById('left');
		var allMenuItems = leftColumn.getElementsByTagName("ul");
		for (var i=0; i<allMenuItems.length; i++) {
			//alert(allMenuItems[i].childNodes.length);
			
			for (var j=0; j<allMenuItems[i].childNodes.length; j++) {
				//info += allMenuItems[i].childNodes[j].nodeName + ": "+ allMenuItems[i].childNodes[j].childNodes[0] + "\n";
				if(allMenuItems[i].childNodes[j].nodeName.toLowerCase() == "li" && allMenuItems[i].childNodes[j].childNodes[0] == document.location.href) {
					//info += "true";
					allMenuItems[i].childNodes[j].className = "active";
				}
			}
		}
	}
}

// adds an eventListener for browsers which support it
function addEvent(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;
	}
}

// add active menu check
//window.onload=ChangeActiveMenuItem;

// -->