var myWindow;


function OpenIt(filename){
	Wwidth = 580;
	Wheight = 600;
	leftX = (screen.width/2) - (Wwidth/2);
	topY = (screen.height/2) - (Wheight/2);
	mywin = window.open(filename,"Search","width="+Wwidth+", height="+Wheight+", left="+leftX+", top="+topY);
	mywin.focus();
}
function OpenService(filename){
	Wwidth = 679;
	Wheight = 520;
	leftX = (screen.width/2) - (Wwidth/2);
	topY = (screen.height/2) - (Wheight/2);
	mywin = window.open(filename,"Search","width="+Wwidth+", height="+Wheight+", left="+leftX+", top="+topY);
	mywin.focus();
}

function OpenBanner(filename,bwidth,bheight){
	leftX = (screen.width/2) - (bwidth/2);
	topY = (screen.height/2) - (bheight/2) - 20;
	myscroll = "1";
	var x=filename;
	if(x.indexOf('http://www.spletna.net/quiz/citroen/prihodnost/igra/')!=-1){
		myscroll = "0";
	}
	mywin = window.open(filename,"Search","width="+bwidth+",scrollbars="+myscroll+", height="+bheight+", left="+leftX+", top="+topY);
	mywin.focus();
}




function pop_up_galery(galery_path){
	w = 500;
	h = 550;
	l = (screen.width/2)-(w/2);
	t = (screen.height/2)-(h/2)-20;
	gurl = 'galery.php?' + galery_path;
	gwin = window.open(gurl,'galerija','toolbar=0,location=0,top='+t+',left='+l+',directories=0,status=0, menubar=0,scrollbars=0,resizable=0,width='+w+',height='+h);
//	gwin = window.open(gurl,'galerija','toolbar=0,location=0,top='+t+',left='+l+',directories=0,status=0, menubar=1,scrollbars=0,resizable=0,width='+w+',height='+h);
}

function OpenWindow(){
		meWidth = 560;
		meHeight = 400;
		meLeft = (screen.width/2)-(meWidth/2);
		meTop = (screen.height/2)-(meHeight/2)-20;
		mywindow = window.open("http://www.spletna.net/quiz/citroen/prihodnost/igra/","la","width="+meWidth+",height="+meHeight+",left="+meLeft+",top="+meTop+",resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,titlebar=0");
		mywindow.focus();
	}

function explodeArray(myitem,delimiter) {
  tempArray=new Array(1);
  var Count=0;
  var tempString=new String(myitem);
  while (tempString.indexOf(delimiter)>0) {
    tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter));
    tempString = tempString.substr(tempString.indexOf(delimiter)+1, tempString.length - tempString.indexOf(delimiter)+1); 
    Count=Count+1
  }
  tempArray[Count]=tempString;
  return tempArray;
}	
	
function check_form(frmObject,fields,lang){
	if(lang==''){
		message = 'Napaka:\n';
		nogood = ' ni izpolnjeno!\n';
	}else{
		message = 'Error:\n';
		nogood = ' is empty!\n';
	}
	not_good = 0;
	objects = explodeArray(fields,',');
	for(i=0;i<objects.length;i++){
		if(frmObject.elements[objects[i]].value==""){
			message = message + frmObject.elements[objects[i]].alt.toUpperCase() + nogood;
			not_good = 1;
		}
	}
	if(not_good){
		alert(message);
		return false;
	}else{
		return true;
	}
}


