// galeria
var dimension="1x1"
var href_target="_new" 
var totalslots=dimension.split("x")[0]*dimension.split("x")[1]

var adres = 'bamble.pl';

function buildimage(i,dir){
var tempcontainer=galleryarray[i][3]!=""? '' : ""
tempcontainer+='<a href="#" onClick="popUpFoto(\'http://'+adres+'/foto.php?fid='+galleryarray[i][3]+'\', \'title\');"><img src="'+galleryarray[i][1]+'" border="0" title="'+galleryarray[i][2]+'"  border="0" width="280"></a>'
//tempcontainer=galleryarray[i][3]!=""? tempcontainer+'</a>' : tempcontainer
//tempcontainer=galleryarray[i][2]!=""? tempcontainer+'<br \/>'+galleryarray[i][2] : tempcontainer
return tempcontainer
}

function jumptopage(p){
var startpoint=(p-1)*totalslots
var y=1;
for (i=0; i<totalslots; i++){
document.getElementById("slide"+i).innerHTML=(typeof galleryarray[startpoint+i]!="undefined")? buildimage(startpoint+i) : ""
}
while(document.getElementById("navlink"+y)!=null){
document.getElementById("navlink"+y).className=""
y++
}
document.getElementById("navlink"+p).className="current"
}

function popUp(url) {
	window.open(url,"FAQ","scrollbars=1,width=550, height=400") ;
}

function popUpparametr(url, title, width, height) {
	window.open(url,title,"scrollbars=1,width="+width+", height="+height) ;
}

function popUpFoto(url, title) {
	window.open(url,title,"toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=200,height=200") ;
}

function checkSubmit() {
	var form = document.szukaj;
	
	if (form.cid.options[form.cid.selectedIndex].value == '0') {
			alert('Musisz wybrać rodzaj ogłoszenia');
	} else form.submit();
}

function clear_this(c,v1,v2)
{
	if (c.value == v1)
		c.value = v2;
}


///----- SHOW - HIDE ----- ///
var opened_id=0;

var option1='block';
var option2='none';
var object0='0'; 

function show_hide(id) {
	if((opened_id != 0)&&(opened_id != id)){
		   object2='' + opened_id;
		   opened_id=0;
		   document.getElementById(object2).style.display=option2;
    }
	if (opened_id==0){  
	  opened_id=id;
	  object=''+id;
	  document.getElementById(object).style.display=option1;
	  document.getElementById(object0).style.display=option2;
	 
	}                                        
	else{ 
		  opened_id=0;
		  object=''+id;
		  document.getElementById(object).style.display=option2;
		  document.getElementById(object0).style.display=option1;
	}
}

function confirmLink(tekst, url) {
	question = confirm(tekst);
	if (question !="0"){
		window.location.href = url;
	}	
}
