/*
 * Index page scripts 
 */

/* 
 * Change area image onmouseover on index page 
 */
function highlight_map (region, out) {
        var LinkItem = document.getElementById("area_" + region);
        var HighlightItem = document.getElementById("area_highlight");

        if (!out) {
                LinkItem.style.textDecoration = "underline";
                HighlightItem.style.backgroundPosition = 354 + (-354 * region) + 'px 0px';
        } else {
                LinkItem.style.textDecoration = "none";
                HighlightItem.style.backgroundPosition = '354px 0px';
        }

        return true;
}

/*
 * Popup new news window
 */
var newWin;
  

// Firefox startpage info box 
function startpage_ff() {
	document.getElementById('startpage_ff').style.display = 'none'; 
	document.getElementById('startpage_ff_info').style.display = 'block'; 		
	startpage_set(); 
}

// See if startpage-icon cookie is set 
function startpage_cookie_get() {
	var cookies = document.cookie.split("; ");	
	
	for(i = 0; i < cookies.length; i++) {
		if(cookies[i] == "b_sp=1") 
			return true;
	}	

	return false;
}

/* Register click in cookie and add statistics */ 
function startpage_set() {
	/* Set cookie */
	var cookie_expire = new Date();                                
	cookie_expire.setTime(cookie_expire.getTime() + 1000*60*60*24*365);
	cookie_expire=cookie_expire.toGMTString();
	document.cookie="b_sp=1; expires="+cookie_expire+";";

	/* Ajax */
	ajax_request("/redir?s=startpage_click&nc=1", null, startpage_callback, null, true, "GET"); 

	/* Hide icon */
	document.getElementById("startpage_ie").style.display = 'none'; 
}

/* Dummy callback */
function startpage_callback(result, xmlhttp, link) {
}

/* Hide FF-info box */
function startpage_ff_info_close() {
	document.getElementById("startpage_ff_info").style.display = 'none';
}

/* Save default ca */
function startpage_set_default_ca(ca, domain) {
	setCookie('default_ca', ca, 365, '/', domain, false);

	return true;
}

