﻿function ValidateForm(obj){

if(obj.SearchText.value == "" && obj.SearchCountry.selectedIndex < 1){
    alert('You must provide a search term and/or select a country');
    return false;
}
    return true;
}


function FindPosY(obj){
var curTop = 0
     if(obj.offsetParent){
           while(obj.offsetParent){
             curTop += obj.offsetTop
            obj = obj.offsetParent
           
           }
      }
	  else if(selectmenu.y){
            curTop += selectmenu.y
           }
           return  curTop;
			                       
}



function FindPosX(obj){
var curTop = 0
     if(obj.offsetParent){
           while(obj.offsetParent){
             curTop += obj.offsetLeft
            obj = obj.offsetParent
           
           }
      }
	  else if(selectmenu.x){
            curTop += selectmenu.x
           }
           return  curTop;
			
}
function ResetForm(formID,doReset){

    try{
        var oForm

        if( formID != null){

            if(document.getElementById){
                oForm = document.getElementById(formID);
            }
            else{
                oForm = eval('document.' + formID);
            }
        }
        
        
        
        if (oForm == null ) oForm = document.forms[0];
        if (oForm != null) {
            if(doReset == null | doReset == ''){
                var i = 0

                while(element = oForm.elements[i++]){
                    if( element.type == 'image') break;
                    
                    switch (element.tagName){
                        case 'SELECT':
                  
                        if (element.id.indexOf("Searchtypes") == -1){
                            element.selectedIndex = 0;
                            }
                        break;
                        case 'TEXTAREA':
                        alert(formID)
                        element.value = "";
                        break;
                    case 'INPUT':
                    
                        switch(element.type){
                            case 'text':
                            case 'password':
                            element.value = '';
                            break
                            case 'checkbox':
                            element.checked = false;
                            break;
                            case 'radio':
                           
                            element.checked = false;
                           
                            if (element.name != null && element.name != ''){
                                if(oForm(element.name).length > 1){
                                 oForm(element.name)[0].checked = true;}
                                else{
                                    oForm(element.name).checked = true;
                                }
                            }
                            
                            
                        }
               
                    }//switch
                }//while
             }//if
             else{
                oForm.reset();
            }
        }//if not null
    }//try
    catch(er){

        return false;
    }
    return false;
}

function SetDropdownMenus(){

  
    var appstring = navigator.userAgent.toLowerCase(); 
  
        if( document.all && appstring.indexOf('opera') == -1){
            var ieUls = document.getElementById('menuItemsUl')
            if(ieUls != null){
	            var ieLIs = ieUls.getElementsByTagName('LI');
	            for (var i=0; i<ieLIs.length; i++) if (ieLIs[i]) {
		            ieLIs[i].onmouseover=function() {
            			

			            this.className="over";
            			
			            }
	                ieLIs[i].onmouseout=function() {
		            this.className="";
		            }
	            }
	        }
        }
   
}





function hideDropdowns(){

   
    var appstring = navigator.userAgent.toLowerCase(); 
  
        if( document.all && appstring.indexOf('opera') == -1){
                var ieULParent = document.getElementById('menuItemsUl')
                if(ieULParent != null){
                
               
                    ieULs = ieULParent.getElementsByTagName('UL');
                    /** IE script to cover <select> elements with <iframe>s **/
                    for (j=0; j<ieULs.length; j++) {
                    ieULs[j].innerHTML = ('<iframe  scrolling="no" frameborder="0"></iframe>' + ieULs[j].innerHTML);
                  
	                    var ieMat = ieULs[j].firstChild;
            	    
		                    ieMat.style.width=ieULs[j].offsetWidth+"px";
		                    ieMat.style.height=ieULs[j].offsetHeight+"px";	
		                    ieULs[j].style.zIndex="99";
            		    
                    }
                 }
        }
 

}
