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 setClass( hEl, sClass )
  {
    hEl.className = sClass
 }
 
function ChangeDiv ( div1, div2, link1, linktxt1, linktxt2 ) {
	var d1 = document.getElementById( div1 )
	var d2 = document.getElementById( div2 )
	var a1 = document.getElementById( link1 );
    
	if (d1.style.display == "block") {
		d1.style.display = "none";
		d2.style.display = "block";
		a1.innerHTML = linktxt1;
	} else {
		d1.style.display = "block";
		d2.style.display = "none";
		a1.innerHTML = linktxt2;
	}
  	
   
}


function ShowElem(Elem,hide1){

  var FormElem = document.getElementById( Elem )
  var hideElem1 = document.getElementById( hide1 )  
  if(FormElem)
   if((FormElem.style.display == "none") || (FormElem.style.display == "")) {
    FormElem.style.display = "block";
	if (hideElem1)
	hideElem1.style.display = "none";
   }
  else    
    FormElem.style.display = "none";
}

function ShowHide(Elem){
	var FormElem = document.getElementById( Elem )
	if((FormElem.style.display == "none") || (FormElem.style.display == "")) {
    FormElem.style.display = "block";
	}
  else    
    FormElem.style.display = "none";
}


function StepByStep( Position, MaxCount, Container, Prefix, FirstElement){

    var SelectArray =  new Array();
    var PropertyContainer = document.getElementById( Container );


    for(cL = 0; cL < MaxCount; cL++)
     SelectArray[cL] = document.getElementById( Prefix+cL );

     if(SelectArray[Position].value == "" || !PropertyContainer ){

         for(cL = Position+1; cL < MaxCount; cL++)
           while(SelectArray[cL].options.length > 1)
             SelectArray[cL].options[SelectArray[cL].options.length - 1] = null;

     }else{

        for(cL = Position+1; cL < MaxCount; cL++){
         SelectArray[cL].options.length = null;
         SelectArray[cL].options[SelectArray[cL].options.length] = new Option(FirstElement,"")
         }


         var FoundNewItemKeys = new Array();

         var AvailArray = PropertyContainer.getElementsByTagName( 'a' );
          for(cA = 0; cA < AvailArray.length; cA++)

           if(AvailArray[cA].getAttribute('linkedid') == SelectArray[Position].value){

             SelectArray[Position+1].options[SelectArray[Position+1].options.length] = new Option(AvailArray[cA].getAttribute('name'), AvailArray[cA].getAttribute('itemid'))
          }


     }

}

function StepByStepUnique( Position, MaxCount, Container, Prefix, FirstElement){

 var SelectArray = new Array();
 var PropertyContainer = document.getElementById( Container );


 for(cL = 0; cL < MaxCount; cL++)
 SelectArray[cL] = document.getElementById( Prefix+cL );

if(SelectArray[Position].value == "" || !PropertyContainer ){

 for(cL = Position+1; cL < MaxCount; cL++)
 while(SelectArray[cL].options.length > 1)
 SelectArray[cL].options[SelectArray[cL].options.length - 1] = null;

 }else{

 for(cL = Position+1; cL < MaxCount; cL++){
 SelectArray[cL].options.length = null;
 SelectArray[cL].options[SelectArray[cL].options.length] = new Option(FirstElement,"")
 }


var FoundNewItemKeys = new Array();

 var AvailArray = PropertyContainer.getElementsByTagName( 'a' );
 for(cA = 0; cA < AvailArray.length; cA++)

 if(AvailArray[cA].getAttribute('linkedid') == SelectArray[Position].value){

 SelectArray[Position+1].options[SelectArray[Position+1].options.length] = new Option(AvailArray[cA].getAttribute('name'), AvailArray[cA].getAttribute('itemid'))
 }


 }

}function CreateBookmarkLink(url, title) {
	
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { 
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) {
		return true; }
 }
 
 
 
 
 function disable()
 {
 var magazine = false;
 var other = false
  var exother = false
 
 if(document.form1.hear[0].checked == false)
    exother = true;
 
 if(document.form1.hear[1].checked == false)
    magazine = true;
    
    
 if(document.form1.hear[5].checked == false)
    other = true;    

  document.form1.exh_country.disabled = exother;
  document.form1.mag_name.disabled = magazine;
  document.form1.hearothertext.disabled = other;
 
 if (exother == true)
  document.form1.exh_other.disabled = true;  
  
 if (other == true)
  document.form1.mag_other.disabled = true; 
 }


function enableOther()
 {

 if((document.form1.hear[0].checked )&&(document.form1.exh_country.value == "Other"))
  document.form1.exh_other.disabled = false;
 else  
  document.form1.exh_other.disabled = true;
 
 if((document.form1.hear[1].checked )&&(document.form1.mag_name.value == "Other"))
  document.form1.mag_other.disabled = false;
 else  
    document.form1.mag_other.disabled = true;
 }
 
 function ShowAdv ( div1, link1, elem, cl, lg ) {
	var d1 = document.getElementById( div1 );
	var a1 = document.getElementById( link1 );
	var el1 = document.getElementById( elem );
   if(lg==2){ 
	if (d1.style.display == "block") {
		d1.style.display = "none";
		el1.className = '';
		a1.innerHTML = 'advanced search';
	} else {
		d1.style.display = "block";
		el1.className = cl;
		a1.innerHTML = 'hide advanced search';
	}
  }	

     if(lg==1){ 
	if (d1.style.display == "block") {
		d1.style.display = "none";
		el1.className = '';
		a1.innerHTML = 'разширено търсене';
	} else {
		d1.style.display = "block";
		el1.className = cl;
		a1.innerHTML = 'скрий разширеното търсене';
	}
  }	
  

     if(lg==12 || lg==3){ 
	if (d1.style.display == "block") {
		d1.style.display = "none";
		el1.className = '';
		a1.innerHTML = 'Расширенный поиск';
	} else {
		d1.style.display = "block";
		el1.className = cl;
		a1.innerHTML = 'Закрой расширенный поиск';
	}
  }	 
}
function fastSearch(form,field,newVal)
{
	
}
