function ccopen(promo,hLink,yPos,showMulti) {
	ccopen.promo = promo;
	ccopen.hLink = hLink;
	ccopen.src = 'http://banners.commissionking.com/popup/iframe.php?promo='+ccopen.promo+'&link='+ccopen.hLink;
	ccopen.width  = 732;
	ccopen.height = 334;
	ccopen.xPos = ccopen.width * -1;
	ccopen.yPos = yPos;
	ccopen.endX = (window.innerWidth ? (window.innerWidth + ccopen.xPos) / 2 : (document.body.clientWidth + ccopen.xPos) / 2);
	ccopen.focusOn = false;
	
	if(!ccopen.readCookie() || showMulti) {
		ccopen.overlay();
	}
}

ccopen.loadEvent = function()   { ccopen.setIntIn(); }
ccopen.setIntIn = function()    { ccopen.interval = window.setInterval(ccopen.moveIn,10); }
ccopen.setIntOut = function()   { ccopen.interval = window.setInterval(ccopen.moveOut,10); }
ccopen.setDelay = function()    { ccopen.timeout = window.setTimeout(ccopen.setIntOut,4000); }
ccopen.clearDelay = function()  { window.clearTimeout(ccopen.timeout); }
ccopen.clearInt = function()    { window.clearInterval(ccopen.interval); }

ccopen.overlay = function() {
	var html = "<div id=\"ccOverlay\" style=\"background: url('http://banners.commissionking.com/popup/images/frame.gif'); z-index: 1000; position: absolute; left: "+ccopen.xPos+"px; top: "+ccopen.yPos+"px; width: "+ccopen.width+"px; height: "+ccopen.height+"px; clear: both; margin: 0; padding: 0;\">\n"
			 + "<div style=\"margin: 4px 4px 0 0; height: 24px; text-align: right;\"><a href=\"javascript:ccopen.closeWindow();\"><img src=\"http://banners.commissionking.com/popup/images/closebtn.gif\" style=\"border: none;\" /></a></div>\n"
			 + "<iframe id=\"ccOverlayIframe\" width=\""+(ccopen.width-12)+"\" height=\""+(ccopen.height-34)+"\" src=\""+ccopen.src+"\" border=\"0\" scrolling=\"no\" frameborder=\"no\" style=\"border: none; margin: 0 6px;\" onmouseover=\"ccopen.inFocus();\" onmouseout=\"ccopen.outFocus();\"></iframe>\n"
			 + "</div>\n";
	
	document.body.innerHTML += html;
	ccopen.container = document.getElementById('ccOverlay');
	ccopen.container.style.display = "block";
	ccopen.iframe  = document.getElementById('ccOverlayIframe');

	if(document.all) {
		ccopen.iframe.attachEvent("onload",ccopen.loadEvent);
	} else {
		ccopen.iframe.onload = ccopen.loadEvent;
	}
	ccopen.setCookie();
}

ccopen.moveIn = function() {
	if(ccopen.xPos < ccopen.endX) {
		ccopen.xPos += 10;
		ccopen.container.style.left = ccopen.xPos+'px';
	} else {
		ccopen.clearInt();
		if(!ccopen.focusOn) {
			ccopen.setDelay();
		}
	}
}

ccopen.moveOut = function() {
	if(ccopen.xPos > ccopen.width * -1) {
		ccopen.xPos -= 10;
		ccopen.container.style.left = ccopen.xPos+'px';
	} else {
		ccopen.clearInt();
		ccopen.clearDelay();
	}
}

ccopen.inFocus = function() {
	ccopen.focusOn = true;
	ccopen.clearInt(); // stop moving out
	ccopen.clearDelay(); // stop count down
	ccopen.setIntIn(); // Move back to mid screen
}

ccopen.outFocus = function() {
	ccopen.focusOn = false;
	ccopen.setDelay();
}

ccopen.setCookie = function() {
	document.cookie = "ccopen=true;";
}

ccopen.readCookie = function() {
	var c = document.cookie;
	var ind = c.indexOf("ccopen");
	if (ind == -1) {
		return(false); 
	}
	var ind1 = c.indexOf(';',ind);
	if (ind1 == -1) {
		ind1 = c.length;
	}
	if(unescape(c.substring(ind+"ccopen".length+1,ind1)) == "true") {
		return(true);
	}
}

ccopen.closeWindow = function() { 
	ccopen.container.style.display = "none";
	ccopen.clearDelay();
	ccopen.clearInt();
}

