j$(document).ready(function(){
	// 2. for terms and conditions page. make them accordion like. 
	j$('dl.accordion>dd').hide();
	j$('span.switch_m').hide();
	j$('dl.accordion>dt').click(function(){
		j$("span.switch_p",j$("dd.acc_contents:visible").not(j$(this).next()).prev()).show();
		j$("span.switch_m",j$("dd.acc_contents:visible").not(j$(this).next()).prev()).hide();
		j$("dd.acc_contents:visible").not(j$(this).next()).toggle();

		j$(this).next().toggle();
		j$("div.sbDummy").jScrollPane({showArrows:true,scrollbarWidth:16,arrowSize:18});
		j$("span.switch_p",this).toggle();
		j$("span.switch_m",this).toggle();
		
		var sp = j$("div.sbDummy")[0];
		if(sp){
			sp.scrollTo("#1");
		}
	});
	j$('div.closebtn a').click(function(){
		j$(this).parent().parent().hide();
		j$("div.sbDummy").jScrollPane({showArrows:true,scrollbarWidth:16,arrowSize:18});
		j$("span.switch_p",j$(this).parent().parent().prev()).show();
		j$("span.switch_m",j$(this).parent().parent().prev()).hide();
	});
	j$('dl.accordion>dt,div.closebtn a').hover(function(){
		j$(this).css("cursor","pointer");
	},function(){
		j$(this).css("cursor","default");
	});
	j$('a#jumptoterm').click(function(){
		//reset
		j$("span.switch_p").show();
		j$("span.switch_m").hide();
		j$("dl.accordion>dd:visible").hide();
		//open term
		j$("dt#4").next().show();
		j$("span.switch_p",j$("dt#4")).hide();
		j$("span.switch_m",j$("dt#4")).show();

		var sp = j$("div.sbDummy")[0];
		if(sp){
			sp.scrollTo("#1");
		}
	});
});

function scrollpaneload(){
	// 1. set scroll bars ===========================================
	var scrollpane = j$("div.sbDummy")[0];
	if(scrollpane){
		j$("div.sbDummy").jScrollPane({showArrows:true,scrollbarWidth:16,arrowSize:18,animateTo:true});
	}
}

function popUp(tgturl, winname, winwidth, winheight, winscroll, winstatus, winresize, xpos, ypos) {
	if (xpos == 'center') {
		xpos = (screen.width - winwidth) / 2;
	}
	if (ypos =='center') {
		ypos = (screen.height - winheight) / 2;
	}
	winoption = "left="+xpos+",top="+ypos+",width="+winwidth+",height="+winheight+",scrollbars="+winscroll+",status="+winstatus+", resizable="+winresize;
	subwin = window.open(tgturl, "", winoption);
	subwin.focus();
}
