function is_IE(){
	if (navigator.appName=="Microsoft Internet Explorer"){
		return true;
	}else {
		return false;
	}
};

function adjustIFrameSize(id) {
    var myIframe = document.getElementById(id);
    if (myIframe) {
        if (myIframe.contentDocument && myIframe.contentDocument.body.offsetHeight) {
            // W3C DOM (and Mozilla) syntax
            myIframe.height = myIframe.contentDocument.body.offsetHeight;
        } else if (myIframe.Document && myIframe.Document.body.scrollHeight) {
            // IE DOM syntax
            myIframe.height = myIframe.Document.body.scrollHeight;
        }
    }
}

function centerScreenWindow(){
	//alert("centriraj");
	if (is_IE){
		diffl= document.body.clientWidth;
		difft= document.body.clientHeight;
	}else {
		diffl= document.body.clientWidth;
		difft= window.innerHeight;
	}
	var winl = (screen.width - diffl) / 2;
	var wint = (screen.height - difft) / 2;
	window.moveTo(winl, wint);
}

function adjustWindowSize() {
	iw= document.getElementById("ref_img").width;
	ow= document.body.clientWidth;
	ih= document.body.scrollHeight;
	if (is_IE()){
		oh= document.body.clientHeight;
	}else {
		oh= window.innerHeight;
	}
	//alert(iw + " - " + ih + "\n" + ow + " - " + oh + "\n" + (iw-ow) + " - " + (ih-oh));
	window.resizeBy(iw-ow, ih-oh);
	var ii;
	centerScreenWindow();
}

function img_pop(img, w, h) {
	if (!window.popup_window || window.popup_window.closed){
		popup_window= window.open("img_pop.php?img=" + img, "", "width=" + w + ", height=" + h + ", top=50, left=50");
		popup_window.focus();
	}else{
		window.popup_window.location.href= "img_pop.php?img=" + img;
		window.popup_window.focus();
	}
}

function winpop(mypage, w, h) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl;
	win = window.open(mypage, '', winprops);
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function change_bgcolor(element, bgcolor) {
	//if (event.type == "mouseover" || event.type == "mouseout") {
		//document.getElementById(element.id).style.backgroundColor= bgcolor
		element.style.backgroundColor= bgcolor;
	//}
}

function sit2eur (sit, euro_rate) {
	return Math.round(sit / euro_rate);
}

function eur2sit (eur, euro_rate) {
	return Math.round(eur * euro_rate);
}

function check_all(field) {
	//alert(field.length);
	for (ii=0; ii<field.length; ii++) {
		field[ii].checked= true;
	}
}

function uncheck_all(field) {
	for (ii=0; ii<field.length; ii++) {
		field[ii].checked= false;
	}
}

function check_numeric(input_field){
	input_field.value= input_field.value.match(/\d*/);
}

function load_news(url_main, url_right2){
	window.main.location.href= url_main;
	window.right.location.href= url_right2;
	window.banners.location.reload();
}

function reload_banners() {
	//parent.window.banners.location.reload();
	window.banners.location.reload();
}

function reload_banners_right(){
	window.banners_right.location.reload();
}