
function onSubmitForm1() {
    //alert("submitam")
}

function toggleDisplay(inTagID, visible) {
    var arStr = inTagID.split(";");
    for (i in arStr) {
        var src = document.getElementById(arStr[i]);
        if (visible!=null) {
            if (visible)
                src.style.display = "";
            else
                src.style.display = "none";
        } else {
            if (src.style.display=="none")
                src.style.display = "";
            else
                src.style.display = "none";
        }
    }
}

function UplPic()//inFullPath
{
    document.getElementById('ctl00_ContentPlaceHolder1_hFullPath').value = document.getElementById('ctl00$ContentPlaceHolder1$uplSlika1').value;
//  document.getElementById('hidden1').value = document.getElementById('file1').value;
//  document.all('hFullPath').value = inFullPath;
	aspnetForm.action='?a=u';
	aspnetForm.submit();
	return true;
}


function ShowPopUp(inURL) {
	var Height = 480;
	var Width = 640;
				
	if (inURL.toLowerCase().lastIndexOf("print.aspx") != -1) {
		Height=640; Width=730; }
	return window.open(inURL,"","width=" + Width + ",height=" + Height + ",location=no,toolbar=no,resizable=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no");
}
//-----------------------------------------------------------------------------

function SetAsHomePage(inPage) {
	 inPage.style.behavior='url(#default#homepage)';
	 inPage.setHomePage('http://www.slobodna-zona.hr');
}
//-----------------------------------------------------------------------------

function TestInt(fieldID, inputData)			//Da li je vrijednost cijeli broj
{
	var result1 = inputData.indexOf(".");
	var result2 = inputData.indexOf(",");
	var i = false;

	if (result1 != -1 || result2 != -1)			//Vrijednost cijeli broj?
	{
		alert("Upišite cijeli broj.");
		document.getElementById(fieldID).focus();
		i = true;
		return false;
	}

	if (isNaN(inputData)==true && i == false)		//Vrijednost numeric?
 	{
 		alert("Upišite cijeli broj.");	
		document.getElementById(fieldID).focus();
		return false;
	}
}
//-----------------------------------------------------------------------------

function checkDate(formName,name,inputDate)
{ 
   var date         = new String (inputDate);
   var endOfString  = date.length;
   var charX        = "";
   var newDate      = "";
   var j            = 0; 
   var k            = 0;
   
   for (var i = 0; i < endOfString; i++) {
        charX = date.charAt(i);
         
        if ((!isNaN (charX)) && (charX != " ")) {
            newDate = newDate + charX; 
        } else {
            if ((charX == ":")||(charX == ".") || (charX == "-") || (charX == ";") || 
                (charX == ",")||(charX == "/") || (charX == " ")) {   
                k++;
                newDate = newDate + ".";
            } else {
                j++;
            }
        }
    }
    if ((k != 2) || j != 0 || endOfString > 10) {
          alert ("Upišite datum '" + date + "' u formatu 'dd.mm.gggg'.");
		return false;
		document.formName.name.focus();
		//setfocus();
    } else {
//        document.forms[formName].elements[name].value = newDate;

    }
 }   
//-----------------------------------------------------------------------------






function InitButton(inMenu, inSwitch)
{
var inMenuID;
inMenuID = inMenu.id.replace('CtrMenuUp1_GumbMeni','');

	if (inMenuID.indexOf('07') != -1) {
		if (inSwitch == 'on')
			{inMenu.style.backgroundImage='url(images/t1on.gif)';
			inMenu.onmouseout = "";}
		else if (inSwitch == 'off')
			{inMenu.style.backgroundImage='url(images/t1off.gif)';}
	}	
}
//-----------------------------------------------------------------------------


function ShowModalPopUp(inForm, dirDepth)
{
	var Height = 480;
	var Width = 640;
	var strDepthText = "";
				
	if (inForm.toLowerCase().lastIndexOf("print.aspx") != -1)
		{Height=330; Width=600; }
	//else if (inForm.toLowerCase().lastIndexOf("frmsmallcalendar.aspx") != -1)
	//	{Height=250; Width=285; }
	
	for(i=0;i<dirDepth;i++)
		strDepthText += "../"
	
	return window.showModalDialog(strDepthText + "empty.aspx?Form=" + inForm, inForm, "dialogHeight:" + Height.toString() + "px;dialogWidth:" + Width.toString() + "px; help:no; status:no; menubar=no; scrollbars=yes; location=no; toolbar=no; directories=no; copyhistory=no; resizable=yes;");
}
//-----------------------------------------------------------------------------



function CloseWindow()	{
	window.close();
}
//-----------------------------------------------------------------------------

function Meni(inMeniID)	{
	Form1.action='?MenuID=' + inMeniID;
	Form1.submit();
}
//-----------------------------------------------------------------------------


/* Toggle Display */
function tglDisp(id, inbFilter)
{
   if(document.getElementById) {
      if(document.getElementById(id).style.display == "none") {
         eval("document.getElementById(id).style.display = \"\"");
         if(inbFilter==1)
			{document.all.imgColapse.src="../img/minus.gif";}
      } else {
         eval("document.getElementById(id).style.display = \"none\"");
         if(inbFilter==1)
			{document.all.imgColapse.src="../img/plus.gif";}
      }
   } else {
      if(document.layers) {
         if(document.layers[id].display = "none") {
            document.layers[id].display = "";
         } else {
            document.layers[id].display = "none";
         }
      } else {
         if(document.all) {
            if(eval("document.all." + id + ".style.display") == "none") {
               eval("document.all." + id + ".style.display = \"\"");
               if(inbFilter==1)
					{document.all.imgColapse.src="../img/minus.gif";}
            } else {
               eval("document.all." + id + ".style.display = \"none\"");
               if(inbFilter==1)
					{document.all.imgColapse.src="../img/plus.gif";}
            }
         }
      }
   }
}
//-----------------------------------------------------------------------------

function SetFocus(inFld)
{	inFld.focus();
	inFld.select();}

function DeleteRecord(inPitanje, inKey, inAddQryString, inDataToDelete)
{
if (window.confirm(inPitanje + '\n' + inDataToDelete) )	{
    var aspnetForm = document.getElementById("aspnetForm");
	aspnetForm.action='?RecAct=3&DelKey=' + inKey + inAddQryString;
	aspnetForm.submit();
	return true;
	}
else
	{return false;}
}

function ShowDetails(inDetailKey, inAddQryString)
{
	Form1.action='?DetailKey=' + inDetailKey + inAddQryString;
	Form1.submit();
	return true;
}

function jsRowOver(inObj, inSelRowColor, inSelRowTextColor)
{
	inObj.style.cursor = 'hand';
	inObj.style.backgroundColor = inSelRowColor;
	inObj.style.color = inSelRowTextColor;
}

function jsRowOut(inObj, inRowColor, inRowTextColor)
{
	inObj.style.cursor = 'auto';
	inObj.style.backgroundColor = inRowColor;
	inObj.style.color = inRowTextColor;
}

function FormatDecimal(num) {
	//DecimalSymbol
	DecimalSymbol = ",";
	re = /\D/g;
	LastIndexOfSep = num.lastIndexOf(DecimalSymbol);
	if (LastIndexOfSep != -1)
		num = num.substr(0, LastIndexOfSep).replace(re, "") + DecimalSymbol + 
		num.substr(LastIndexOfSep, num.length - LastIndexOfSep).replace(re, "");  
	else
		num = num.replace(re, "");
	return num;
	}





// Test
function Test()
{
document.all.imgColapse.src="../img/plus.gif";
document.all.imgColapse.src="../img/minus.gif";
}
// Test


