var last = 'none';
function select_div(div_group, div) {
	for (i=0 ; i < div_group.length ; i++) {
		if (div_group[i] == div) {
			tmp = document.getElementById(div)
			if (tmp.style.display == 'block') tmp.style.display = 'none';
			else tmp.style.display = 'block';
		} else {
			document.getElementById(div_group[i]).style.display = 'none';
		}
	}
}

function switch_div(div) {
	tmp = document.getElementById(div)
	if (tmp.style.display == 'block') tmp.style.display = 'none';
	else tmp.style.display = 'block';
}
function t(name) {
	x = document.getElementById(last);
	x.style.visibility = "hidden";
	x = document.getElementById(name);
	x.style.visibility = "visible";
	last = name;

	x = document.getElementById(sublast);
	x.style.visibility = "hidden";
}
var sublast = 'none';
function ts(name) {
	x = document.getElementById(sublast);
	x.style.visibility = "hidden";
	x = document.getElementById(name);
	x.style.visibility = "visible";
	sublast = name;

	x = document.getElementById(subsublast);
	x.style.visibility = "hidden";
}
var subsublast = 'none';

function tss(name) {
	x = document.getElementById(subsublast);
	x.style.visibility = "hidden";
	x = document.getElementById(name);
	x.style.visibility = "visible";
	subsublast = name;
}
function rank_document (type_, id_, rank_) {
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';
	jsel.src = "/rank.php?type=" + escape(type_) + "&id=" + escape(id_) + "&rank=" + escape(rank_);
	document.body.appendChild (jsel);
	return true;
}
function modify_ranking (type_, id_, rank_) {
	div = document.getElementById('rank_' + type_ + '_' + id_);
	div.innerHTML = 'תודה שדרגת. הדירוג כעת: ' + rank_;
}

function setCookie(c_name, value, expiredays) {
	var exdate=new Date()
	exdate.setDate(exdate.getDate()+expiredays)
	document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires="+exdate.toGMTString())
}

function getCookie(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 addfav() {
	title = "הפתק הסגול";
	url = "http://www.hapetek.co.il/";
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title);
	} else if(window.opera && window.print) { // Opera Hotlist
		return true;
	}
}
