
function show_cats(act_num)
{
	var targetElement = document.getElementById('categories_popout');
	var posy = (tempY - 25 - 330) + "px";
	
	if(act_num == 1){
		targetElement.style.top = posy;
		targetElement.style.visibility = 'visible';
	} else {
		targetElement.style.visibility = 'hidden';
	}

}

function show_ilogin(act_num)
{
	var targetElement = document.getElementById('login_popout');
	var targetDropdown = document.getElementById('stype');
	var posy = tempY + "px";
	var posx = (tempX-250) + "px";
	
	if(act_num == 1){
		targetElement.style.top = posy;
		targetElement.style.left = posx;
		targetElement.style.visibility = 'visible';
		targetDropdown.style.visibility = 'hidden';
		document.il_login.UserName.focus();
	} else {
		targetElement.style.visibility = 'hidden';
		targetDropdown.style.visibility = 'visible';
	}

}


function show_coupon(act_num)
{
	var targetElement = document.getElementById('coupon_popout');
	var targetDropdown = document.getElementById('stype');
	var posy = tempY + "px";
	var posx = (tempX-300) + "px";
	
	if(act_num == 1){
		targetElement.style.top = posy;
		targetElement.style.left = posx;
		targetElement.style.visibility = 'visible';
		targetDropdown.style.visibility = 'hidden';
	} else {
		targetElement.style.visibility = 'hidden';
		targetDropdown.style.visibility = 'visible';
	}	
	
	  
	
}

function update_coupon(strURL,divname) {
	show_coupon(1);
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('GET', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText,divname);
        }
    }
        self.xmlHttpReq.send(1);
    }

function updatepage(str,divname){
    document.getElementById(divname).innerHTML = str;
}

allow_coupon = 1;

function open_coupon(bounce, cpid)
{
	var rnum = 0;
	rnum = rand();
	if(allow_coupon)
	{
		eval("window.open('" + bounce + "coupon" + cpid + "','_blank')");
	}
}
function disable_coupon()
{
	allow_coupon = 0;
}
function enable_coupon()
{
	setTimeout("allow_coupon = 1",500);
}
function rand ( n )
{
  return ( Math.floor ( Math.random ( ) * n + 1 ) );
}