function getthecookie(c_name) {
	if (document.cookie.length>0) {
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1) {
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) {
				c_end=document.cookie.length;
			}
    		return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}

function checkthelogin() {
	var thecookie = getthecookie('__utmlog');
	if (thecookie == '1') {
	    urchinTracker('/login/my');
	    window.location = 'http://my.idigi.com';
    } else if (thecookie == '2') {
        urchinTracker('/login/dev');
		window.location = 'http://developer.idigi.com';
	} else {
		$.colorbox({iframe: true, href:'/login', innerWidth: 650, innerHeight: 400}); 
	}
}

function setthecookie(whattype) {
	var nDays = 365;
	var today = new Date();
	var expire = new Date();
	if (nDays==null || nDays==0) nDays=-1;
	expire.setTime(today.getTime() + 3600000*24*nDays);
	document.cookie = "__utmlog=" + whattype + ";expires=" + expire.toGMTString() + ";path=/";
	alert('Your login options have been reset');
	document.getElementById('btmnav_hyperlink_loginreset').style.display = 'none';
}
