// JavaScript Document
function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function getCookie(c_name){
	if (document.cookie.length>0)	{
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1)	{ 
			c_start=c_start + c_name.length+1; 
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
	  	}
	}
	return "";
}
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

jQuery(function(){
				
	showNoticePopup = function(url){
		var Height1 = $('body').height();
		var Height2 = f_clientHeight();
		var windowHeight = windowHeight>=Height1?Height2:Height1;
		
		$('#confirm_popup').css('top',f_scrollTop()+Math.round(Height1/2)-270);
		$('#obj_chart').hide();
		var obj = $('#confirm_popup').show();
		$('#btn_confirm_popup_close,#btn_confirm_popup_cancel').click(function(){
																			   $('#confirm_popup').hide()
																			   $('#obj_chart').show();
																			   if ($('#btn_dontshowagain').attr('checked')==true){setCookie('Goingup_no_confirm_popup','1',10);}
																			   });
		$('#btn_confirm_popup_continue').click(function(){ if ($('#btn_dontshowagain').attr('checked')==true){setCookie('Goingup_no_confirm_popup','1',10);} window.location.href=url; });
	}
	jQuery.each( $('a'), 
					function (i,obj){
						if (obj.href.indexOf('http://')!=-1 && 
							obj.href.indexOf('goingup')==-1){
								$(obj).click(function (){
									if (getCookie('Goingup_no_confirm_popup')) return true;
									showNoticePopup(this.href);
									return false;
								})
						}
					}
				   )
});

