// JavaScript Document

/*function boxroll($id){
	document.getElementById($id).style.backgroundPosition = "0px -16px";
}
function boxout($id){
	document.getElementById($id).style.backgroundPosition = "0px 0px";
}
function boxroll2($id){
	document.getElementById($id).style.backgroundPosition = "0px -34px";
}
function boxout2($id){
	document.getElementById($id).style.backgroundPosition = "0px 0px";
}*/
//window.location.href='http://example.xx';
//location.replace()

/*myFunction = function(myHref){
		alert(myHref);
		return false;
}*/
function popup(myhref, myheight){
	if (!myheight){
		myheight = 520;
	}
	Info = window.open(myhref, "CPOSolutions", "width=531,height=" + myheight + ",screenX=200,screenY=100,scrollbars=no");
	Info.focus();
}
function $get(key,url){
	if(arguments.length < 2) url =location.href;
	if(arguments.length > 0 && key != ''){
		if(key == '#'){
			var regex = new RegExp('[#]([^$]*)');
		} else if(key == '?'){
			var regex = new RegExp('[?]([^#$]*)');
		} else {
			var regex = new RegExp('[?&]'+key+'=([^&#]*)');
		}
		var results = regex.exec(url);
		return (results == null )? '' : results[1];
	} else {
		url = url.split('?');
		var results = {};
		if(url.length > 1){
			url = url[1].split('#');
			if(url.length > 1) results['hash'] = url[1];
			url[0].split('&').each(function(item,index){
				item = item.split('=');
				results[item[0]] = item[1];
			});
		}
		return results;
	}
}


window.addEvent('domready', function() {
	var get = $get();
	var fadein = function(){
		var elements = $$('.fade');
		var count = 0;
			var filterElements = elements.filter(function(item, index){ 
					count++;  
			});
		for(var i = 0; i < count; i++){
				if(get.fade != 'partner')
					elements[i].fade('hide');
				elements[i].fade('in');
			};
	}
	
	var fadeout = function(event){
											  
		event.stop();
		var myhref = this.href;
		var elements = $$('.fade');
		var count = 0;
		var filterElements = elements.filter(function(item, index){ 
				count++;  
		});
		
		for(var i = 0; i < count; i++){
			elements[i].fade('out');};
		(function(){ window.location.href = myhref; }).delay(500);
	}

	fadein();
	$$('.myclick').addEvent('click', fadeout);
	$$('.current').removeEvent('click', fadeout);
	$$('.current').addEvent('click', function(event){event.stop();});
		
})