function kup(id, idg) {
	window.open('kupuj.php?id='+id+"&idg="+idg, '','toolbar=no, location=no, direction=no, status=no, menubar=no, scrollbars=no, resizable=no, width=450, height=260');
}

function foto(id) {
	//window.open('http://www.kawu.pl/images/srednie/'+id,'','toolbar=no, location=no, direction=no, status=no, menubar=no, scrollbars=no, resizable=no, width=350, height=260');
	//window.open('foty/'+id+".jpg",'','toolbar=no, location=no, direction=no, status=no, menubar=no, scrollbars=no, resizable=no, width=360, height=280');
	window.open('foto.php?Id='+id,'','toolbar=no, location=no,top=10, left=300, direction=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=500, height=500');
}

function przekieruj(gdzie){
    document.location.replace(gdzie);
}

function usun_konto(){
    var agree=confirm("Czy napewno usun±ć wszystkie dane uzytkownika z bazy danych? Ta operacja jest nieodwracalna!!!");
    if (agree){
    document.forms['aktForm_cennik'].konto_usun.value='1';
    document.forms['aktForm_cennik'].submit();
    }
	

}

function aktywuj_konto(){
   
    document.forms['aktForm_cennik'].konto_akt.value='1';
    document.forms['aktForm_cennik'].submit();
}

szer=screen.width;
wys=screen.height;

    
function otworz_cennik()
{
 //window.open('cennik.php,toolbar=no, location=no, direction=no, status=no, menubar=no, scrollbars=yes, resizable=no, left='+((szer-450)/2)+', top='+((wys-300)/2)+', width=450, height=300');

window.open('cennik.php',"cennik",'toolbar=no, location=no, direction=no, status=no, menubar=no, scrollbars=yes, resizable=no, left='+((szer-450)/2)+', top='+((wys-300)/2)+', width=450, height=300');
}

function potwierdz_zamowienie(lang){
    switch (lang){
    	case 'p':
	    if(confirm('Czy na pewno chcesz złożyć zamówienie?')){
		document.location.replace('zamow.php');
	    }
	    break;
	    
	 case 'e':
	    if(confirm('Do you really want to finalize this order?')){
		document.location.replace('zamow.php');
	    }
	    break;   
    }
}

var tempX = 0;
var tempY = 0;
var flaga=0;

var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;

function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
    
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else {  // grab the x-y pos.s if browser is NS
tempX = e.pageX;
tempY = e.pageY;
}  
if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;}  
return true;
}


function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


function pokaz_diva(kod, ktory){
   
    coords=findPos(ktory);
    scroll_top=document.getElementById('tabler').scrollTop;
    
    //alert(scroll_top);
   document.getElementById('mini_div');
   document.getElementById('mini_div').style.top = coords[1] + 16 - scroll_top;
   document.getElementById('mini_div').style.left = coords[0] - 175;
   
	document.getElementById('fota').src="pub/foty/"+kod+".jpg";
	if(flaga==0){
	    document.getElementById('mini_div').style.visibility='visible';
	}
    flaga=1;
    //alert(kod);
    
}

function schowaj_diva(){
    if(flaga==1){
	document.getElementById('fota').src="images/spacer.gif";
	document.getElementById('mini_div').style.visibility='hidden';
    
    }
    flaga=0;
}

function pisz_mail(konto, serwer)
{
    adres=(konto+'@'+serwer);
    document.write('<A class=\"mail_link\" href=\"mailto:' + adres + '\">' + adres + '</a>');
}

function zmianaIMG(obiekcik_id,idp, id_foty)
{
	 document.getElementById(obiekcik_id).src = 'pub/foty_new/'+idp+'/'+id_foty+'_mini.jpg';
	 //fota=co;
}
