function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function closeColorbox()
{
	if (isMSIE()) 
		closeInfoWindow();
	else
		$("a[rel='call-to-action']").colorbox.close();
}

var call2ActionURL;

function createCall2Action(ref)
{
	if (isMSIE()) 
	{
		call2ActionURL = ref;
	}
	else
	{
		c2a_a = document.createElement('a');
		c2a_a.setAttribute('style', 'display:none');
		c2a_a.setAttribute('title', '');
		c2a_a.setAttribute('rel', 'call-to-action');
		c2a_a.href = ref;
		document.body.appendChild(c2a_a);
		$("a[rel='call-to-action']").colorbox({width:"500",height:"360",initialWidth:"500",initialHeight:"360",iframe:true,scrolling:false,overlayClose:true});
	}
}

function showCall2Action() 
{
	showCall2Action(false);
}

function showCall2Action(forceToShow) 
{
	if (readCookie('call-to-action') == null || forceToShow == true) {
		createCookie('call-to-action','true', 90);
		if (isMSIE()) 
		{
			infoCont=getControlById("divInfoWindowContainer");
			infoWind=getControlById("divInfoWindow");
			infoWind.innerHTML = '<div align="right" style="width:450px"><div style="top:5px;right:5px" id="cboxClose" onclick="closeColorbox()"></div></div><iframe src="' + call2ActionURL + '" width="450" height="380" hspace="0" vspace="0" frameborder="no" scrolling="no" style="background-color:#000000"></iframe>';
			alignToCenter(infoCont,infoWind);
			infoCont.style.visibility = "visible";
			window.onresize=reAlignToCenter;
			window.onscroll=reAlignToCenter;
		}
		else
		{
			$("a[rel='call-to-action']").click();
		}
	}
}

