try {
  
  $(document).ready(function(){
    $("#orderForm").ndFormValidator();
    $('#slide-in').nivoSlider({ pauseTime:5000, pauseOnHover:false });
        
    
    $("#product").change(function(){
      var selProduct = $("#product").val(); 
      var disId = selProduct.split("~");
      var strDisId =  "#"+disId[1];
      
      $("#orderForm fieldset.hidden").hide();
      
      $("#orderForm fieldset.hidden").each(function(el) {
        $(this).find(":input").attr("disabled","disabled");
      });      
      
      $("#orderForm fieldset.hidden .required").each(function(el) {        
        $(this).removeClass("required");
        $(this).addClass("req");        
      });
      
      $("#orderForm "+strDisId+" .req").each(function(el) {
        $(this).removeClass("req");
        $(this).addClass("required");
      });
          
      $("#orderForm "+strDisId).find(":input").removeAttr("disabled");
      
      $(strDisId).fadeIn(600);
      
      $("#orderForm fieldset.otherInfo").fadeIn(600);
      
      //console.debug(strDisId);
    });
    
  });  
  
} catch(err) {
}



function fnSearch() {
    if (GetElement('EXPS').value.length<4) 
	  {alert('Minimal length of searched expression is 3 characters.');return false;
} 
    else {
   		 SetForm('/hledani/default.aspx?layID=1&catid=2577&txbSearch=' + GetElement('EXPS').value,true);} 
}

function fnSearchEn() {
    if (GetElement('EXPS').value.length<4) 
	  {alert('Minimal length of searched expression is 3 characters.');return false;
} 
    else {
   		 SetForm('/hledani/default.aspx?layID=1&catid=5147&txbSearch=' + GetElement('EXPS').value,true);} 
}

function ClearBox(obj, text) {
	if (obj.value=text) obj.value="";
}

function RemoveSubscriber() {
		 SetInternal('RemoveDailySubscriber');
		 document.forms[0].submit();
}

function ValidateSubscriber() {
     if(!IsEmail(GetElement('SubMail'),true,'Neplatná emailová adresa !',false)) return false;
SetInternal('ActivateSubscriber');
document.forms[0].submit();
}

function GetCustomMenuPositionRoot(position) 
{
   position.x = 0;
   position.y = 140;
}

function GetCustomMenuPositionChildren(position)
{
;
}

function GetCustomMenuElementTagName()
{
   return "DIV";
}


if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.dropcontent{display:none;}\n')
document.write('</style>\n')
}

function contractall()
{
	var inc = 0;
	var div = null;
	while (div = document.getElementById("dropmsg"+inc))
	{
		div.style.display="none";
		inc++;
	}
}

/*function expandone()
{
	var elm = document.design.dropmsgoption;
	if (elm)
	{
		contractall();
		var div = document.getElementById("dropmsg" + elm.selectedIndex);
		if (div) div.style.display = "block";
	}
}*/

/*if (window.addEventListener)
window.addEventListener("load", expandone, false)
else if (window.attachEvent)
window.attachEvent("onload", expandone)*/

//*********************************** GALLERY ***************************************

function ClickEvent(e)
{
	var obj;
	var i=0;
	var title = "DISA Group GALLERY";
	
	if (Br.IE)
		obj = window.event.srcElement;
	else
		obj = e.target;

	while(obj.parentNode.tagName!="TBODY" && obj.parentNode.tagName!="TABLE" && i<20)
	{
		obj = obj.parentNode;
		i++;
	}
	obj = obj.childNodes[0].childNodes[0];

	if (typeof(obj)=='object')
		if (obj.tagName=='IMG')
		{
			if (obj.alt!="") title=obj.alt;
			GaleryView(obj, title);
		}
} 

function GaleryView(obj, title)
{
	var ImgURL="";
	var nDot=0;
	var nWidth=10, nHeight=30;
	var _child;
	if (typeof(obj)!='object') return false;
	ImgURL = obj.src;
	if (ImgURL=="" && ImgURL=="undefined") return false;
	nDot = ImgURL.lastIndexOf(".");
	ImgURL = ImgURL.substr(0, nDot) + "big" + ImgURL.substr(nDot, ImgURL.length);

	if (Br.NS)
	{
		nWidth += 14;
		nHeight += 23;
	}

	_child=window.open("about:blank","","height=200,width=200");
	_child.document.write('<html>\n')
	_child.document.write(' <head><title>' + title + '</title></head>\n')
	_child.document.write(' <body leftMargin=0 topMargin=0  onclick="window.close()" style="cursor:pointer; font-family:Verdana; font-size:14px;font-weight:bold;">\n')
	_child.document.write('<script language="javascript">\n');
	_child.document.write('function ResizeWin()');
	_child.document.write('	{window.resizeTo(document.getElementById("foto").width+' + nWidth + ',document.getElementById("foto").height+' + nHeight + ');}\n');
	_child.document.write('function notLoaded()');
	_child.document.write('	{document.getElementById("foto").style.display="none";\n');
	_child.document.write('	document.getElementById("errTxt").style.display="block";');
	_child.document.write('	window.resizeTo(350, 40)}');
	_child.document.write('</script>\n');
	_child.document.write('<div style="display:none;width:100%;padding-top:25px;text-align:center;" id="errTxt">THE PICTURE IS NOT AVAILABLE.</div>\n');
	_child.document.write('<img src="' + ImgURL + '" alt="Click to close this window." id=foto onload="ResizeWin()" onerror="notLoaded()">\n');
	_child.document.write(' </body>\n');
	_child.document.write('</html>\n');
}

