function searchFocused() {
	searchtool.focused();
}

function searchBlurred() {
	searchtool.blurred();
}

function setCookie(c_name, value, expiredays) {
	try {
		var exdate = new Date();
		exdate.setDate(exdate.getDate() + expiredays);
		parent.document.cookie = c_name
				+ "="
				+ escape(value)
				+ ((expiredays == null) ? "" : ";expires="
						+ exdate.toGMTString());
	} catch (err) {
		return false;
	}
	return true;
}

function getCookie(c_name) {
	try {
		if (parent.document.cookie.length > 0) {
			c_start = parent.document.cookie.indexOf(c_name + "=");
			if (c_start != -1) {
				c_start = c_start + c_name.length + 1;
				c_end = parent.document.cookie.indexOf(";", c_start);
				if (c_end == -1)
					c_end = parent.document.cookie.length;
				return unescape(parent.document.cookie
						.substring(c_start, c_end));
			}
		}
	} catch (err) {
		return "";
	}
}

function changevisibility(id) {
	if (document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display = 'block';
	} else {
		document.getElementById(id).style.display = 'none';
	}

	alert(document.getElementById(id).style.display);
}

/* When the window has loaded, call the function */
window.onload = function() {
	//replaceText('h1', false);// H1 elements
	//replaceText('h2', false);// H1 elements

	try {
		searchtool.init();
		
		var searchEl = searchtool.getel();
		searchEl.onfocus = searchFocused;
		searchEl.onblur = searchBlurred;
		
		autoupdate.set();
		 
		if (getCookie('autoupdate') == 1) { autoupdate.addDisable(); } else { autoupdate.addEnable(); }
		 
		stripper.go('noscript', 'tag');
		stripper.go('noscript', 'class');
		swatches.buttons('swatches');
		
		if (window.location.href.match(/home/) && banners.load("rotating")) {
		    banners.run();
		}
	} catch (err) {
		// Fail silently
		//alert(err);
		return false;
	}
}
