function Redirect(sSrc){
	window.location = sSrc;
}

function OpenPopup(sURL, PositionX, PositionY, defaultWidth, defaultHeight){	
		
		var AutoClose = true;
		var isNN=(navigator.appName=="Netscape")?1:0;
		var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
		
		var optNN='scrollbars=yes,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
		var optIE='scrollbars=yes,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;

		if (isNN){imgWin=window.open(sURL,'',optNN);}
		if (isIE){imgWin=window.open(sURL,'',optIE);}
		
		return imgWin;		
	}

    function OpenPicture(sURL){
	    var imgWin;
	    imgWin = OpenPopup(sURL, 10, 10, 800, 600);
	    return true;
    }

	function Files_OpenPopup(sURL){
		OpenPopup(sURL, 0, 0, 800, 600);
	}



function OnBasketItemAdded(iIndex)
{
	window.location = 'P23.asp';
}

function BasketItem_Add(iID)
{
	LoadRemoteDataCallBack('P22.AddBasketItem.asp?ID=' + iID, OnBasketItemAdded, null);
}

function RepositionElts() {
	//objMenu = document.getElementById('mainmenu');	
	//if(objFooter)
	{
		//iMainContentright = (GetDocumentWidth()-770);
		//iMainContentright = Math.round(iMainContentright / 2); 
		
		//objFooter.style.right = iMainContentright;
		//objFooter.style.bottom = 0;
	}
}

/*if(ie) setInterval('RepositionElts()', 1000);*/

function Open4WEBWindow() {
	var hWnd;
	hWnd = window.open('http://www.4web.si/')
	hWnd.focus();
}

var bMouseOverTopMenuButton = 0
var iUnmaskTopMenuButtonsTimerID = 0
function UnmaskTopMenuButtons()
{
	clearInterval(iUnmaskTopMenuButtonsTimerID);
	iUnmaskTopMenuButtonsTimerID = 0;
	if(bMouseOverTopMenuButton) return;
	
	objDivOff = document.getElementById('divTopMenuBtnMaskOff')
	objDivOn = document.getElementById('divTopMenuBtnMaskOn')
	for(var i=1; i <= 7; i+=1)
	{
		GetSubElementByID(objDivOff, i).style.visibility = 'hidden';
		GetSubElementByID(objDivOn, i).style.visibility = 'hidden';
	}
}

function TopMenuBtn(iBtn, bOn) {
	bMouseOverTopMenuButton = bOn;
	//Reset all buttons
	if(!bOn)
	{
		if(!iUnmaskTopMenuButtonsTimerID) iUnmaskTopMenuButtonsTimerID = setInterval('UnmaskTopMenuButtons()', 1);
		return;
	}
	//Display all off buttons
	objDivOff = document.getElementById('divTopMenuBtnMaskOff')
	objDivOn = document.getElementById('divTopMenuBtnMaskOn')
	for(var i=1; i <= 7; i+=1)
	{
		GetSubElementByID(objDivOff, i).style.visibility = 'visible';
		GetSubElementByID(objDivOn, i).style.visibility = 'hidden';
	}
	//Display on button
	GetSubElementByID(objDivOn, iBtn).style.visibility = 'visible';	
	
}

function changeImage(idE, image){
	newImage = "url(" + image + ")";
	document.getElementById('mid'+idE).style.backgroundImage=newImage;
}

function changeImageTop(id, image){
	newImage = "url(" + image + ")";
	document.getElementById(id).style.backgroundImage=newImage;
}

function RunGallery(){
	if ( window.GalleryDisplay )
		GalleryDisplay();
}


/*Main menu*/
//function MainMenu_ChangeClass(obj, class){
	//alert('aa');
	//if isObject(obj) alert(class);
//}
function MainMenu_ChangeClass(objMenu,className){
	if (isObject(objMenu)) objMenu.className = className;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



/* SEARCH */

	function CheckFrmSearch(txtObj, sLink){
	    
	    	
		oS = $(txtObj);
		var sS = oS.value;
		
		if(sS == ""){			
			alert( "Niste vpisali iskane besede.");
			oS.focus();				
			return false;
		}	
		if(sS.length < 3){			
			alert("Iskalna beseda mora vsebovati vsaj 3 znake.");
			oS.focus();				
			return false;
		}	
		window.location = sLink + "&s="+sS;
		return false;
	}
	
	function KeyPress_Search(evt, txtObj, sLink){
	//alert(evn);
	//txtObj = "searchS";
	//alert(txtObj);
	
	var evt = (evt) ? evt : ((event) ? event : null); 
	
	var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); 

	if ((evt.keyCode == 13) && (node.type=="text"))  {	
	 
		return CheckFrmSearch(txtObj, sLink);
	} 
	
	return true;

	}


/*********************************/
/*********** POLL ****************/
/*********************************/

