var pagetitle = document.title;
if (pagetitle != "Page Not Available - Cookies - Carrot Ink") {
	var tmpcookie = new Date();
	chkcookie = (tmpcookie.getTime() + '');
	document.cookie = "chkcookie=" + chkcookie + "; path=/";
	if (document.cookie.indexOf(chkcookie,0) < 0) {
		window.location = 'CookieErrorView?langId=-1&storeId=10001&catalogId=10001';
	}
}

function check2(pressed_key) {
	if(pressed_key==13)
	searchLaunchH();
}

function sendCoreMetrics() {
	var domainName = document.domain;
	if (domainName == "www.carrotink.com" || domainName == "wcpe.carrotink5.com" || domainName == "carrotink.com") {
		cmSetProduction();
	}
	cmCreatePageviewTag("Chat Live",null,"30001");
}

function searchLaunchH(formH) {
	searchname = document.getElementById('name').value;
	if(searchname == "Search Catalog" || searchname == "") {
		sendPage = "/carrot/servlet/AdvancedSearchView?langId=-1&storeId=10001&catalogId=10001";
		window.location.href = sendPage;
		formH.action = sendPage;
		formH.submit();	
	} else {
		formH.submit();
	}
}

/*
Declare global variables
*/
var thisnav = '';

/*
Preload common larger rollover images
*/
common1 = new Image();
common1.src = "/images/arr_orgbox_grybg_roll.gif";

/*
Redirect to no cookies page
*/
function noCookies(redirect) {
	var tmpcookie = new Date();
	chkcookie = (tmpcookie.getTime() + '');
	document.cookie = "chkcookie=" + chkcookie + "; path=/";
	if (document.cookie.indexOf(chkcookie,0) < 0) {
		window.location = redirect;
	} else {
		return("true");
	}
}

/*
Clear default value of text input
*/
function clearField(thefield) {
	if (thefield.defaultValue==thefield.value)
	thefield.value = ""
}


/*
General image swap function
*/
function imgSwap(id, src) {
	if (document.getElementById(id)) {
		document.getElementById(id).setAttribute('src', src);
	}
}

/*
Image swap function for Site Policies
*/
function imgSwap2(id, src) {
	if (document.getElementById(id)) {
		document.getElementById(id).setAttribute('src', src);
	}
}

/*
Swap leftnav image
*/
function navRoll(id, over) {
	if (over) {
		imgSwap('nav'+id, '/images/arr_orgbox_orgbg_roll.gif');
	} else {
		imgSwap('nav'+id, '/images/arr_orgbox_orgbg.gif');
	}
}

/*
Swap top nav image and text link underline
*/
function topRoll(id, over) {
	(over || id == thisnav) ? over = '_roll' : over = '';
	imgSwap(id, '/images/topnav_'+id+over+'.gif');
}

/*
Swap bottom nav image and text link underline
*/
function btmRoll(id, over) {
	(over || id == thisnav) ? over = '_roll' : over = '';
	imgSwap(id, '/images/btmnav_'+id+over+'.gif');
}

/*
Swap top sub nav image and text link underline
*/
function topsubRoll(id, over) {
	(over || id == thisnav) ? over = '_roll' : over = '';
	imgSwap(id, '/images/topsubnav_'+id+over+'.gif');
}

var cmJv="1.5";

function showNews(curid) {
	if (document.layers) document.layers[''+curid+''].visibility = "show"
	else if (document.all) document.all[''+curid+''].style.visibility = "visible"
	else if (document.getElementById) document.getElementById(''+curid+'').style.visibility = "visible"
	topsubRoll('newsletter',1);
}

function timedHide(curid) {
	timer1 = setTimeout('hideNews(\''+curid+'\')', 100);
}

function cancelHide(curid) {
	if(typeof( window[ 'timer1' ] ) != "undefined") {
		clearTimeout(timer1);
	}
}

function hideNews(curid) {
	if (document.layers) document.layers[''+curid+''].visibility = "hide"
	else if (document.all) document.all[''+curid+''].style.visibility = "hidden"
	document.getElementById(''+curid+'').style.visibility = "hidden"
	topsubRoll('newsletter');
}

function hidePromo(promoDiv) {

if (document.layers) document.layers[''+promoDiv+''].display = "none"
else if (document.all) document.all[''+promoDiv+''].style.display = "none"
document.getElementById(''+promoDiv+'').style.display = "none"

}
