var pos="";

function _openImg(url, w, h)
 { 	w=w+30;
 	h=h+30;
 	parh="/img/galary/"+url;    window.open(parh,"_blank","width="+w+",height="+h+",scrollbars=0,status=0,statusbar=0,resizable=1");
 }





function $(id) {
	var el = document.getElementById(id);
	return el?el:false;
}

function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
var xcoord=20;
	var ycoord=20;
var currentimageheight = 24;
function setXY(e){
xcoord=20;
ycoord=20;

var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15;
var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);


	if (typeof e != "undefined"){

			xcoord += e.pageX;
			ycoord += e.pageY;


	} else if (typeof window.event != "undefined"){


			xcoord += truebody().scrollLeft+event.clientX;

			ycoord += truebody().scrollTop + event.clientY;

		//alert(xcoord+' '+ycoord);
	}

	if(ycoord < 0) { ycoord = ycoord*-1; }


}


function setPos(el) {
	$(el).style.left = mX+10;
	$(el).style.top = mY+15;
}

function open_material(ord)
  {  	pos="blmtrl"+ord;
  	$(pos).style.display='block';
  	$(pos).style.left = xcoord+10;
	$(pos).style.top = ycoord+15;

  }

function _close(ord)
 {    pos="blmtrl"+ord;
     $(pos).style.display = 'none';
     pos="";
 }

function InitAjax()
  {
  	  try {
     request = new XMLHttpRequest();
   } catch (trymicrosoft) {
     try {
       request = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (othermicrosoft) {
       try {
         request = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (failed) {
         request = false;
       }
     }
   }
   if (!request)
     alert("Error initializing XMLHttpRequest!");

     document.onmousemove = setXY;
  }

function _AjAddinBasket(ord)
 {
    coltvr=1;


 	JsHttpRequest.query(
            '/basket.php',
            {
                'ordtvr': ord,
                'ctvr': coltvr
            },
            function(result, errors) {
               document.getElementById("basketBox").innerHTML=errors;

            },
            true
         );

 }

function _allcheck()
  {
  	colsS=document.basketform.allcols.value;
  	if(document.basketform.allcheck.checked){for(i=1;i<=colsS;i++){document.getElementById("dels"+i).checked=true;}}
  	else{for(i=1;i<=colsS;i++){document.getElementById("dels"+i).checked=false;}}
  }
var popup='';
function show(i) {
	document.getElementById(i).style.display='block';
	popup=i;
}

function hidep(i) {
	if(i=='')document.getElementById(popup).style.display='none';
	else document.getElementById(i).style.display='none';
}

function show_hide(i) {
	if (document.getElementById(i).style.display=='none') {
		document.getElementById(i).style.display='block'
	}
	else {
		document.getElementById(i).style.display='none';
	}
}

function set_size() {
	document.getElementById('png').style.height=document.getElementById('container').offsetHeight + 'px';
	document.getElementById('png').style.width=document.getElementById('container').offsetWidth + 'px';
}

function showpopup(img, w, h) {	show('png');
	show('popup');
	var l=Math.round(w/2);
	var t=Math.round(h/2);
	t='-'+t+'px';
	l='-'+l+'px';
	document.getElementById("popup").style.width=w+'px';
	document.getElementById("popup").style.height=h+'px';
	document.getElementById("popup").style.marginTop=t;
	document.getElementById("popup").style.marginLeft=l;	document.getElementById("BigImage").src=img;

}


function phone() {
	show('png');
	show('phone_msg');

}

function _openlist(obj, ord)
 { 	obj.src='/images/minus.gif';
 	if(document.getElementById("blck"+ord))
 	   { var elem=document.getElementById("blck"+ord); 	   	 if(elem.style.display=='block')elem.style.display='none';
 	   	 else elem.style.display='block';

 	   }

 }



