var isIE = false;
(navigator.userAgent.indexOf('MSIE') != -1) ? isIE = true : null;

var slide_horiz;
function init() {
	slide_horiz = new Spry.Effect.Slide('content', {horizontal: true, toggle: false, duration:1000, from: '0%', to: '100%'});
	slide_horiz.start();
}

function menuOver(obj) {
	isIE ? obj.setAttribute("className", "menuboxover") : obj.setAttribute("class","menuboxover");
}

function menuOut(obj) {
	isIE ? obj.setAttribute("className", "menubox") : obj.setAttribute("class","menubox");
}

function launchcategory(url){
	window.name = 'opener'; 
	remote = open(url, "", "resizable,status,scrollbars,width=500,height=400,left=300,top=100");
} 
function launchevent(url){
	self.name = "opener"; 
	remote = open(url, "", "resizable,scrollbars,width=600,height=400,left=300,top=100");
} 
function launchlog(url){
	window.name = 'opener'; 
	remote = open(url, "", "resizable,status,scrollbars,width=600,height=650,left=300,top=100");
} 
function launchlogin(url){
	window.name = 'opener'; 
	remote = open(url, "", "resizable,status,scrollbars,width=400,height=300,left=300,top=100");
} 
function launchuser(url){
	window.name = 'opener'; 
	remote = open(url, "", "resizable,status,scrollbars,width=650,height=600,left=300,top=100");
}

function displayProperties(obj) {
	var names ="";
	for(var name in obj) {
		if(obj[name] + "" != "null")
			names += name + " = " + obj[name] + "\n";
	}
	alert(names);
}

function getArgs() {
	var args = new Object();
	var query = location.search.substring(1);
	var pairs = query.split('&');

	for(i=0; i<pairs.length;i++) {
		var pos = pairs[i].indexOf("=");
		if(pos==-1) continue;
		var argname =  pairs[i].substring(0,pos);
		var value = pairs[i].substring(pos+1);
		args[argname] = unescape(value);
	}
	return args;
}

function showContent(id) {
	window.location.href = "/0"+id+".php";
	return;
	var b;
	for(var i=0; i<5; i++) {
		b = document.getElementById("btn_" + i);
		if(b) {
			if(i == id) {
				isIE ? b.setAttribute("className", "menuboxover") : b.setAttribute("class","menuboxover");
				b.setAttribute("onmouseover", "");
				b.setAttribute("onmouseout", "");
				b.setAttribute("onclick", function() { hideContent() });
			} else {
				isIE ? b.setAttribute("className", "menubox") : b.setAttribute("class","menubox");
				b.setAttribute("onmouseover", function() { menuOver(this) });
				b.setAttribute("onmouseout", function() { menuOut(this) });
				b.setAttribute("onclick", function() {showContent(this.id.split("_")[1])});
			}
		}
	}

	var c = document.getElementById("content");
	var s = document.getElementById("content_"+id+"");

//	alert(s.innerHTML);
	if(c && s) {
		c.innerHTML = s.innerHTML;
		slide_horiz.start();
	}
	
}

function hideContent() {
	return;
	/*for(var i=0; i<5; i++) {
		b = document.getElementById("btn_" + i);
		if(b) {
			isIE ? b.setAttribute("className", "menubox") : b.setAttribute("class","menubox");
			b.setAttribute("onmouseover", function() { menuOver(this) });
			b.setAttribute("onmouseout", function() { menuOut(this) });
			b.setAttribute("onclick", function() {showContent(this.id.split("_")[1])});
		}
	}
	slide_horiz.start();
	*/
}

