//poprandom = Get_Cookie
function Get_Cookie(name) {
	var start = document.cookie.indexOf(name+"=");
	var len = start+name.length+1;
	if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
	if (start == -1) 
		return null;
	var end = document.cookie.indexOf(";",len);
	if (end == -1) 
		end = document.cookie.length;return unescape(document.cookie.substring(len,end));
}
function popupcheck(){
	var popcookie1 = Get_Cookie("poped25082001")
	var popcookie2 = Get_Cookie("poped25082001")
	var popcookie3 = Get_Cookie("poped25082001")
	var popcookie4 = Get_Cookie("poped25082001")
	var showpop = false;
	var randomvalue;
	var terminal = 1111;
	var checkcount = 0;
	var bannercount = 4;
	
	while (checkcount < terminal) {		 
		randomvalue = (((Math.floor((bannercount - 1 + 1) * Math.random() + 1))%bannercount)+1);
		//alert(randomvalue + "-" + checkcount);
		switch (randomvalue) {
		case 1:
			if  ((popcookie1 != "true") && (!showpop)){
				poprandom1();  				
    				checkcount = terminal;
			}
			else {
				if ((checkcount%10)<1) {
					checkcount = checkcount + 1;
				}
			}
			break;
		
		case 2:
			if  ((popcookie2 != "true") && (!showpop)){
				poprandom2();
    				checkcount = terminal;
			} else {
				if ((checkcount%100)<10) {
					checkcount = checkcount + 10;	
				}
			}
			break;
            
		case 3:
			if  ((popcookie3 != "true") && (!showpop)){
				poprandom3();
    				checkcount = terminal;
			} else {
				if ((checkcount%1000)<100) {
					checkcount = checkcount + 100;	
				}
			}
			break;
            
		
		case 4:
			if  ((popcookie4 != "true") && (!showpop)){
				poprandom4();
    				checkcount = terminal;
			} else {
				if (checkcount<1000) {
					checkcount = checkcount + 1000;	
				}
			}
			break;
		}
	}
}
function poprandom1() {
	window.open('/hkstock/popup/popup.htm','popup','menubar=0,scrollbars=0,height=430,width=300');
}
function poprandom2() {
	window.open('/hkstock/popup/popup.htm','popup','menubar=0,scrollbars=0,height=430,width=300');
}
function poprandom3() {
	window.open('/hkstock/popup/popup.htm','popup','menubar=0,scrollbars=0,height=430,width=300');
}
function poprandom4() {
	window.open('/hkstock/popup/popup.htm','popup','menubar=0,scrollbars=0,height=430,width=300');
}