var WidthArr = ["320","480","1000","1000","974","1230"];
var HeightArr = ["200","360","400","500","668","924"];

function popup(n,u,w,h,t) {
	var size = GetCookie('SIZE');
	
	if(size == '' || size == null){
		size = 2;
	}
	else {
		size = parseInt(size);
	}
	
	if (w == null){
		w = parseInt(WidthArr[size]) + 90;
	}
	
	if (w < 0){
		w = parseInt(WidthArr[size]) + 90;
	}
	if (h == null){
		h = parseInt(HeightArr[size]) + 180;
	}
	if (h < 0){
		h = parseInt(HeightArr[size]) + 180;
	}
	
	if(n == '') {
		var d = new Date();
		n = n + "Chart_At_Date_" + d.getMonth() + "_" + d.getDate() + "_" + d.getYear() + "_";
		n = n + "Time_" + d.getHours() + "_" + d.getMinutes() + "_" + d.getSeconds();
	}
	if(navigator.appName.indexOf("Microsoft") >= 0){
		w = 1035;
		h = 635;
	}
	else {
		w = 1035;
		h = 620;
	}
	
	if (u != null) {
		if (u.indexOf('?') == -1) {
			if (u.indexOf('hideHF=') == -1) u = u + '?hideHF=1';
		}
		else {
			if (u.indexOf('hideHF=') == -1) u = u + '&hideHF=1';
		}
		if (t != null) u = u + '#' + t;
		win = window.open(u, n, 'width=' + w + ',height=' + h +',toolbar=0,location=0,directories=0,status=1,menubar=0,resizable=1,scrollbars=0,center=1');

		if (win.opener == null) win.opener = self;
		window.name = 'Chart';
		win.focus();
	}
}

function GetCookie(name){
	var prefix = name + "=";
	var start = document.cookie.indexOf(prefix);
	if(start == -1 || name == '' || name == null)
		return '';
			
	var end = document.cookie.indexOf(";", start + prefix.length);
	if(end == -1)
		end = document.cookie.length;
			
	var value = document.cookie.substring(start + prefix.length, end);
	return value;
}

function dialog(url, name, width, height){
	window.showModalDialog(url, name, 'dialogWidth=' + width + 'px;dialogHeight=' + height + 'px;help=no;center=yes;status=no;scrollbars=0;scrollbars=;border=thin;');
}

function windowPop(url,name,features) {
  window.open(url,name,features);
}


