//===================================================
	function openWin( windowURL, windowName, windowFeatures ) { 
		return window.open( windowURL, windowName, windowFeatures ) ; 
	}
//===================================================
	function smallwindow(str)
	{
		newWindow = window.open( str, null, 'width=300,height=200,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0,left=10,top=10' );
		newWindow.focus();
	     	return false;
	}
//===================================================
	function openFormInNewWindow(frm, wname){
			var leftVal = (screen.width-300) / 2;
			var topVal = (screen.height-200) / 2;
			
			var aWindow = window.open( '', wname, 'width=300,height=200,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0,top='+topVal+',left='+leftVal+'' );
			if (!aWindow.opener) aWindow.opener = self;

		  frm.target = wname;
		  frm.submit();
	}
//===================================================
	function smallwindow_sized(str,xwidth,xheight)
	{
		newWindow = window.open( str, null, 'width='+xwidth+',height='+xheight+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1,left=100,top=100' );
		newWindow.focus();
	     	return false;
	}
//===================================================
//Use: onkeydown="JustNumbers();"
//
	function JustNumbers()
	{
		var key_code = window.event.keyCode;
		//alert(key_code)
    		if (!window.event.shiftKey && !window.event.ctrlKey && !window.event.altKey) {
                  //48-57       Alpha numeric
                  //96-105      Numeric numeric ;)
                  //37-39       Left-right
                if ((key_code < 48 || (key_code >57 && key_code < 96) || key_code > 105) && (key_code!=8 && key_code!=9 && key_code!=37 && key_code!=39)) event.returnValue=false;
		//if ((key_code < 96 || key_code > 105) && (key_code!=8 && key_code!=9)) event.returnValue=false;
                }
	}
//===================================================
function IsNumeric(strString)
   //  check for valid numeric strings
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

//transfer
function skok(kam)
	{
	 	location = kam;
	}

//onfocus input
function cistic(komu,original)
	{
	if (komu.value==original)
	 { 	komu.value=''; }
	}
	
//onblur input
function opravar(komu,co)
	{
		if (komu.value=='')
	 	 { komu.value=co; }
	 flip_class();
	}
	
//kontrola formulara main
function kontroluj_main(formularius)
	{
      if (formularius.nick.value=="meno")
	     {
		  alert("Musíš zadať meno !");
		  formularius.nick.focus();
		  return false;
		 }
	  else if (formularius.txt.value=="")
	    {
		 alert("Musíš zadať text k otazke");
		 formularius.txt.focus();
		 return false;
		}
	  else
	    {
	     return true;
		}
	}

//kontrola formulara quest	
function kontroluj_quest(formularius)
	{
      if (formularius.quest.value=="otazka")
	     {
		  alert("Musíš zadať nazov otazky !");
		  formularius.quest.focus();
		  return false;
		 }
      else if (formularius.nick.value=="meno")
	     {
		  alert("Musíš zadať meno !");
		  formularius.nick.focus();
		  return false;
		 }
	  else if (formularius.txt.value=="")
	    {
		 alert("Musíš zadať text k otazke");
		 formularius.txt.focus();
		 return false;
		}
	  else
	    {
	     return true;
		}
	}	
	
//flip farby v inputoch
function flip_class() 
{
		 tab=document.getElementById('nick');
		 if (tab.value=='meno')
		  {tab.className='sform';}
		 else
		  {tab.className='sform_flip';}
		 tab=document.getElementById('email');
		 if (tab.value=='email')
		  {tab.className='sform';}
		 else
		  {tab.className='sform_flip';}
		 tab=document.getElementById('www');
		 if (tab.value=='www')
		  {tab.className='sform';}
		 else
		  {tab.className='sform_flip';}
}

//flip textu butonov aktivujucich scrolling
function flipbutton(nieco,text1,text2)
{
	if (nieco.value==text1)
	 { nieco.value=text2; }
	else
	 { nieco.value=text1; }
	 flip_class();
}

//podla kukis nastav pozadie (ak sa ti to podari:)
function dartbg_onload()
{
	var dartbg = GetCookie('dartbg');
	if (dartbg==null)
	 { SetCookie("dartbg",1);
	   flip_bg_online(1);
	 }
	else if (dartbg!=1)
	 { SetCookie("dartbg",dartbg);
	   flip_bg_online(dartbg);
	 }
}
//===================================================
	function myFill(name,value){
		fox = document.getElementById(name)
		if (fox.tagName=="INPUT") {
			fox.value = value
		}else{
			fox.innerHTML = value
		}
	}
//===================================================
	function myGet(name){
		fox = document.getElementById(name)
        if (fox.value==undefined){
            x="";
        }
		else if (fox.value==""){
            x="";
        }
		else{
            x=fox.value;
        }
		return x
	}
//===================================================
	function myGetX(name){
		fox = document.getElementById(name)
		return fox
	}
//===================================================
	function flipcolor(obj)
	{
		b=obj.className;
		if (b=="colflip1"){
		obj.className="colflip31";
		}else if(b=="colflip2"){
		obj.className="colflip32";
		}
		else if(b=="colflip32"){
		obj.className="colflip2";
		}
		else if(b=="colflip31"){
		obj.className="colflip1";
		}

		else if(b=="colflip1light"){
		obj.className="colflip2light";
		}
		else if(b=="colflip2light"){
		obj.className="colflip1light";
		}
		
		else if(b=="colflip1dark"){
		obj.className="colflip2dark";
		}
		else if(b=="colflip2dark"){
		obj.className="colflip1dark";
		}
        
        
		else if(b=="colflipMenuMainOff"){
		obj.className="colflipMenuMainOn";
		}
		else if(b=="colflipMenuMainOn"){
		obj.className="colflipMenuMainOff";
		}
		else if(b=="colflipMenuSubOff"){
		obj.className="colflipMenuSubOn";
		}
		else if(b=="colflipMenuSubOn"){
		obj.className="colflipMenuSubOff";
		}
	}
//===================================================
	function flipselected(obj){
		b=obj.className;
		if (b=="colflip1"){
		obj.className="colflip71";
		}else if(b=="colflip2"){
		obj.className="colflip72";
		}
		else if(b=="colflip32"){
		obj.className="colflip72";
		}
		else if(b=="colflip31"){
		obj.className="colflip71";
		}
		else if(b=="colflip72"){
		obj.className="colflip32";
		}
		else if(b=="colflip71"){
		obj.className="colflip31";
		}
	}
//===================================================
	function flipcolor_menu_old(obj)
	{
		b=obj.className;
		if (b=="menu_in"){
		obj.className="menu_out";
		}else if(b=="menu_out"){
		obj.className="menu_in";
		}
	}
//===================================================
    function flip_menu(obj){
      //alert(obj.style.backgroundImage)
        b=obj.className;
        if (b=="mmenu_off"){
            obj.className="mmenu_on";
        }else if(b=="mmenu_on"){
            obj.className="mmenu_off";
        }else if(b=="mmenu_sel"){
            obj.className="mmenu_unsel";
        }else if (b=="smenu_off"){
            obj.className="smenu_on";
        }else if(b=="smenu_on"){
            obj.className="smenu_off";
        }

    }
//===================================================
    function form_check_registration(obj,cemu){

	if (cemu!=201){
	     if (myGet("txt_loginr")=="" && myGet("txt_registration_type")!=1){
	    		alert("Login je povinny");
	    		myGetX("txt_loginr").focus();
	    		return false;
	     }
		 if (cemu!=210){
				  if (myGet("txt_passwordr")=="" && myGet("txt_registration_type")!=1){
			    	 alert("Heslo je povinne");
			   		 myGetX("txt_passwordr").focus();
			    	 return false;
			    }else if (myGet("txt_passwordr")!=myGet("txt_password2") && myGet("txt_registration_type")!=1){
			    	 alert("Potvrzeni hesla se neshoduje s heslem.");
			    	 myGetX("txt_password2").focus();
			    	 return false;
			    }
		 }
     }
	 

    if (myGet("txt_name")==""){
    	 alert("Jmeno je povinny.");
    	 myGetX("txt_name").focus();
    	 return false;
    }else if (myGet("txt_street")==""){
    	 alert("Ulice je povinna.");
    	 myGetX("txt_street").focus();
    	 return false;
    }else if (myGet("txt_city")==""){
    	 alert("Mesto je povinne.");
    	 myGetX("txt_city").focus();
    	 return false;
    }else if (myGet("txt_zip")==""){
    	 alert("PSC je povinne.");
    	 myGetX("txt_zip").focus();
    	 return false;
    }else if (myGet("txt_country")==""){
    	 alert("Zeme je povinne.");
    	 myGetX("txt_country").focus();
    	 return false;
    }else if (myGet("txt_tel")=="" && myGet("txt_mobil")==""){
    	 alert("Musi byt vyplneny aspon jeden telefon\nDoporucujeme vyplnit mobil.");
    	 myGetX("txt_mobil").focus();
    	 return false;
    }else{
    	return true;
    }
}
//............................................... Cookies management
function GetCookie (name) {  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) {    
var j = i + alen;    
if (document.cookie.substring(i, j) == arg)      
return getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) break;   
}  
return null;
}

function SetCookie (name, value) {  
var DartExpDays = 30;
var DartExp = new Date(); 
DartExp.setTime(DartExp.getTime() + (DartExpDays*24*60*60*1000));

var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var expires=DartExp; //add by dart
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}

function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function DeleteCookie (name) {  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);  
var cval = GetCookie (name);  
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
//===================================================
	function DisableAllInput(xdisable){
		var xDoc = document.body.getElementsByTagName("input");
		var xSel = document.body.getElementsByTagName("select");
		var i=0
		var s=""
		//disable all textbox, checkbox
		for (i=0;i<xDoc.length;i++){
			if (xDoc.item(i).getAttribute("type") != "submit"){
				xDoc.item(i).disabled=xdisable;
			}
		}
		//disable all select
		for (i=0;i<xSel.length;i++){
				xSel.item(i).disabled=xdisable;
		}
		return true
	}
//===================================================
	 function ShowHide(name){
		var obj=myGetX(name);
		
		if (obj.style.display==""){
			obj.style.display="none";
		}else{
			obj.style.display="";
		}
	}
	
	function myShowHide(objID,show){
		var objCT=myGetX(objID);
		
		show = typeof(show) != 'undefined' ? show : -1;
		
		if (show==-1){
			if (objCT.style.display==""){
				objCT.style.display="none";
			}else{
				objCT.style.display="";
			}
		}else if(show==1){
			objCT.style.display="";
		}else{
			objCT.style.display="none";
		}
	}
	
//===================================================
	function SwapBgPic(myobj, mybgpic){
		var obj=document.getElementById(myobj)
		obj.style.background = "url(" + mybgpic + ")"; 
	}
