function settings_submit(chk2chk, name){
  var value = chk2chk.checked ? 1 :0 ;
  set_cookie(name, value, 1000 * 3600 * 24 * 30);            
  document.settings.submit();
  return true;
}

function showad(){
  if (screen.width < 1000) {
    showdiv('banner2_img');
  }
  return true;
}

function calsubmit(year, month, url) {
  if (url) document.cal.action=url; 
  if (year) document.cal.calyear.value=year;
  if (month) document.cal.calmonth.value=month;
  document.cal.submit();
  return false ;
}
//  ********************* General Cookie handling      *********************
function get_cookie ( cookie_name ){
  var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );
  if (results) return ( unescape ( results[1] ) );
  else return null;
}

function set_cookie ( name, value, expire, path, domain, secure ){
  var cookie_string = name + "=" + escape ( value );
  if ( expire ){
		var cookie_date = new Date() ;
		cookie_date.setTime ( cookie_date.getTime() +cookie_date.getTimezoneOffset()+ expire );
    cookie_string += "; expires=" + cookie_date.toGMTString();}
  if (path) cookie_string += "; path=" + escape ( path );
  if (domain) cookie_string += "; domain=" + escape ( domain );
  if (secure) cookie_string += "; secure";
  document.cookie = cookie_string;
}

function showdiv(id) {
	//safe function to show an element with a specified id
	var status = 'block' ;
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == 'block') {
			status = 'none' ;}
		document.getElementById(id).style.display = status ;
	}else{
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}	else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function showlogo(sec) {
  if (this.timer) { clearTimeout(this.timer);	this.timer = 0; }
  this.timer = setTimeout("showdiv('logo_doboz')", sec*1000);
}

function showplusminus(id1, id2) {
	//safe function to show an element with a specified id
	var status1 = 'inline' ;
	var status2 = 'none' ;
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id1).style.display == status2) {
  		document.getElementById(id1).style.display = status1 ;
  		document.getElementById(id2).style.display = status2 ;
    }else{
  		document.getElementById(id1).style.display = status2 ;
  		document.getElementById(id2).style.display = status1 ;
    }
	}else{
		if (document.layers) { // Netscape 4
			document.id1.display = status1;
		}	else { // IE 4
			document.all.id.style.display = status1;
		}
	}
}

function CreateBookmarkLink() {
title = "Hirdetéspiac"; 
url = "http://www.hirdetespiac.hu";
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
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
}
urchinTracker('/outgoing/addtofavorites');
}

function checkUncheckAll(theElement) {
	var theForm = theElement.form, z = 0;
	for(z=0; z<theForm.length;z++){
    if(theForm[z].type == "checkbox" && theForm[z].name != "checkall"){
			theForm[z].checked = theElement.checked;}
	}
}

function getwindowsize(which) {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  if (which == 'h') return myHeight ;
  return myWidth ;
}

function showwind(content) {
  option = "width=960, height=720, scrollbars=1, resizable=1, status=0";
  newwind = window.open("", "newwind", option) ;
  newwind.focus();
  newwind.document.writeln(content); 
}

function showpic(url) {
content ="<HTML><HEAD>";
content +="<TITLE>Kép megtekintése</TITLE>";
content +="</HEAD><BODY style='cursor:pointer; cursor:hand;' onClick='window.close()'>";
content +='<div style="display:table; height:100%; width:100%; #position: relative; overflow: hidden;">';
content +='<div style=" #position: absolute; #top: 50%;display: table-cell; vertical-align: middle;">';
content +='<div style=" #position: relative; #top: -50%">';
content +="<CENTER><IMG HSPACE=0 VSPACE=0 SRC='"
content += url + "'><BR /><BR />Kattintson, ha be akarja zárni</CENTER>";
content +="</div></div></div></BODY></HTML>";
showwind(content) ;
}
