try {
  $(function() {
  	$.fn.nyroModal.settings.processHandler = function(settings) {
  		var from = settings.from;
  		if (!settings.type && from && from.href) {
  			/*alert(
  				'type should be image: '+settings.type + '\n'
  				+ "need to determine if image manually");*/
  			var arr = from.href.split('?');
  			//if carrying extra stuff
  			if(arr.length>1){
  				var newArr=arr[0].split('.');
  				var newType=settings.type;
  				//alert('extension is: ' + newArr[newArr.length-1]);
  				switch(newArr[newArr.length-1].toUpperCase()){
  					case 'IMG':
  					case 'JPG':
  					case 'JPEG':
  					case 'PNG':
  					case 'GIF':
  					case 'ASPX':
  						newType='image';
  						break;
  					default:
  						newType=settings.type;
  				}
  				//alert("new type is " + newType);
  				$.nyroModalSettings({
  					type: newType
  				});
  			}
  		}
  	};
  	
  });
  
  $(document).ready(function(){										
	  // definice horniho menu
	  $(".topMenu").ndMenu({showActiveClass:"False"});
    
    // Nastaveni Javascriptove validace prislusnym formularum dle ID
    $(".allForms").ndFormValidator();
    $(".form-poradna").ndFormValidator();
        	
    
  	/* ANKETA  */
  	$('#inquiry a').click(function(){
  		
  		var idAnketa = $(this).attr('class').substring($(this).attr('class').indexOf('|')+1);
  		//console.log(idAnketa);
  		
  		var COOKIE_NAME = window.location.hostname+"_anketa_"+idAnketa;
  		var options = { path: '/', expires: 10 };
  		
  		if($.cookie(COOKIE_NAME))
  		{
  			alert("Váš hlas již byl započítán!");
  		} else {
  			$.cookie(COOKIE_NAME, 'mcInquiry', options); 
  			
  			$.post(".", {InternalEventState:"PollClick",InternalEventValue:$(this).attr('class')});
  			alert("Děkujeme za Váš názor!");
  			location.reload(true);
  		}
  		
  		return false;
  	});
    
    $('.loadCalculate').nyroModal({
      autoSizable: false,
      resizable: false,
      windowResize: false,
      width: 700,
      height: 500
    });
   						
	});
 
  
  
} catch(err) {

}

// Funkce pro volani boxu s informacnimi zpravama
function callMessageBox(message) {
  $(document).ready(function(){  
    $.nyroModalManual({      
      minWidth: 300,
      minHeight: 80,      
      bgColor: '#E0E0E0',      
      content: message,
      css: {      
        wrapper: {
          background: '#ffffff url(../img/info.gif) no-repeat 10px 10px',
          padding: '10px 10px 10px 60px',
          border:'3px solid #007AC3'
        },
        content: {          
          padding: '10px'         
        }        
      }
    });
    
  });
}

// funkce pro zrušení defaultního textu input pole END

function KillDefaultText(elementValue,elementId) {
  if(document.getElementById(elementId).value == elementValue) {
    document.getElementById(elementId).value = "";
  }
}

// funkce pro zrušení defaultního textu input pole END

// funkce pro zpětné vložení def. textu START

function PasteDefaultText(elementValue,elementId) {
  if(document.getElementById(elementId).value == "") {
    document.getElementById(elementId).value = elementValue;
  }  
}

// funkce pro zpětné vložení def. textu END

// funkce pro vlozeni fotek z fotogalerie ke clanku START
function GenerateCustomFckGallery(files_array)
{
		var result="";
		for (var a=0;a<files_array.length;a++)
			result+="<a class=\"nyroModal\" href=\""+files_array[a].path+"\" rel=\"gal\"><img class=\"body-gallery\" alt=\"\" src=\""+files_array[a].thumb+"\" /></a>";
		return result;
}
// funkce pro vlozeni fotek z fotogalerie ke clanku END

