// JavaScript Document
browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion);
if (browser_name == "Netscape" && browser_version >= 3.0) { roll = 'true'; }
else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 3.0) { roll = 'true'; }
else if (browser_name == "Opera" && browser_version >= 3.0) { roll = 'true'; }
else { roll = 'false'; }
function changeone(img,path) { if (roll == 'true') { document.images[img].src = path; } }

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

var preloadFlag = false;
function preloadImages() {
        if (document.images) {
				t1_over = newImage("images/bottom_4rome_lt.gif");				
				t2_over = newImage("images/text_bg.gif");
                preloadFlag = true;
        }
}


function submit_query(formName, actionName, actionValue) {
	var form_obj = eval("document."+formName);
	eval("window.document."+formName+"."+actionName).value = actionValue;
	return true;
}
function submit_query_prompt(formName, actionName, actionValue, msg) {
	if ((msg != "") && (!window.confirm(msg))) {
		return false;
	}
	return submit_query(formName, actionName, actionValue);
}
function clearInput(formName, inputName) {
	eval("document."+formName+"."+inputName).value = '';
}


function view_image(path, width, height, id) {
	//window.confirm(path);
	//window.location = "admin/popup/view_image.php?"+path;
	pop = popup("units/catalog/view_image.php?file="+path+"&id="+id, "popup", width, height, false, false, 50, 150);
}

// Открытие нового окна ----------------------------------------------------------------------------------------------------------------------

function _cms_scripts_sections_common_open_new_common_window(window_name, window_url, window_width, window_height) 
{
	if (window_width > (screen.width-50)) window_width = screen.width-50;
	if (window_height > (screen.height-100)) window_height = screen.height-100;
	var pos_x=Math.round((screen.width-window_width)/2);
	var pos_y=Math.round((screen.height-window_height)/2);
	return open( window_url, window_name, "resizable=yes, scrollbars=yes, status=no, menubar=no, width=" + window_width + ", height=" + window_height + ", left="+pos_x+", top="+pos_y);
}

function popupbyname(url){
	var xPos = window.screenLeft+10;
	var yPos = window.screenTop+20;
	var param = " left="+xPos+",top="+yPos+",scrollbars,resizable";
	win = window.open(siteURL + '/objects/editor/viewpopup.php?url='+url, 'filepopup', param);
}
function toggleDiv(id){
	obj = document.getElementById(id);
	tmp = obj.style.display;
	if (tmp == 'none') obj.style.display='block';
	else obj.style.display='none';
}
function show_basket() {
	param = "top=150,left=150,width=630,height=500,scrollbars,resizable";
	popupwindow = window.open(siteURL+"/basket", "BasketWindow", param);
}
