var activeDiv = '';
var lastDiv = '';
function showGallery( oid ){
	props = "toolbar=0,location=0,status=0,scrollbars=0,menubar=0,resizable=0,width=490,height=550,top=50,left=50";
	var win = window.open( "/gallery-frame.php?oid="+oid, "PopupWin", props );
	win.focus();
}
function displayDiv(divId) {
	var aDiv = document.getElementById( divId );
	aDiv.style.visibility = "visible";
	activeDiv = divId;
	lastDiv = divId;
}
function hideDiv(divId) {
	activeDiv = '';
	setTimeout( 'hideDiv2();' , 200 );
}
function hideDiv2() {
	if (activeDiv != lastDiv) {
		var aDiv = document.getElementById( lastDiv );
		aDiv.style.visibility = "hidden";
	}
}

function browserCss() {
	if (browserType == '0') document.write('<link rel="stylesheet" type="text/css" href="/css/ie.css" />');
	if (browserType == '1') document.write('<link rel="stylesheet" type="text/css" href="/css/ns.css" />');
}

function changeMenuPic(menuId,picName) {
	if ( findLayer(menuId) ) {
	var actImg = findLayer(menuId);
	var newSrc = '/images/menu/' + langId + '/' + picName;
	actImg.src = newSrc;
	}
}

function findLayer(item) {
	if( window.mmIsOpera ) return(document.getElementById(item));
	if (document.getElementById) return(document.getElementById(item));
	if (document.all) return(document.all[item]);
	return(false);
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function openCatalog(url) {
    var load = window.open(url,'','scrollbars=no,menubar=no,height=635,width=800,resizable=no,toolbar=no,location=no,status=no');
}

function inBasket(formId,text,error) {
	var sError;
	var doc = document.forms[formId];
	var da = doc.prod_num.value + 0;

	if ((da > 0) && (da <= 1000)) {
		alert(text);
		return true;
	}
		else {
		alert(error);
		return false;
	}
}
