// JavaScript Document
var cCode = getQueryString("cntryCd");
if(cCode.length != 2) cCode = "AE";

$(document).ready(onReady);

function onReady(){
	var c;
	$("#conf_nav a").each(function(){
		c = $(this).attr("href");
		if(c.indexOf("java") == -1){
			$(this).attr("href", c+"?cntryCd="+cCode);	
		}
	});
	
	c = $("#confA").attr("href");
	$("#confA").attr("href", c+"?cntryCd="+cCode);
	
	
	///////////// check if question and answer page
	$("#questions h2").each(function(){
		$(this).click(questionClick);									
		$(this).css("cursor", "pointer");
	})
	
	updateQuestions(null);
}

function updateQuestions(){
	
	$("#questions h2").each(function(){
		$(this).next("div").hide();	
	})
}

function questionClick(){
	var ss = $(this).next("div").css("display") == "block";
	updateQuestions();
	
	if(!ss) $(this).next("div").show();
	return false;
}

function getQueryString(){
	/*
		this function will return a value of a qstring variable if 
		variable name is passed
		otherwise it will return an object with key/value pairs
	*/
	ret = new Object();
	var q = location.href.split("?")[1];
	if(!q) return ret;
	var args = q.split("&");
	for(var n=0; n<args.length; ++n){
		pairs = args[n].split("=");
		if(!pairs[1]) pairs[1] = "";//pairs[0];
		if(arguments[0] == pairs[0]) return pairs[1];
		ret[pairs[0]] = pairs[1];
	}
	return ret;
	
}
