
function replaceAll( str, searchTerm, replaceWith, ignoreCase )   {
   var regex = "/"+searchTerm+"/g";
   if( ignoreCase ) regex += "i";
   return str.replace( eval(regex), replaceWith );
}

// On enter evaluate function
function trapEnter(e, enterFunction){
  if (!e) e = window.event;
  if (e.keyCode == 13){
    e.cancelBubble = true;
    if (e.returnValue) e.returnValue = false;
    if (e.stopPropagation) e.stopPropagation();
    if (enterFunction) eval(enterFunction);
    return false;
  } else {
    return true;
  }      
}


function DesignerSearch(dat){
 window.location = '/dazzle/pages/DesignerHome.aspx?keyword=' + dat
}

function DesignerArchiveSearch(dat){
 window.location = '/dazzle/pages/DesignerArchive.aspx?keyword=' + dat
}

function SiteSearch(dat){
 window.location = '/dazzle/pages/searchresults.aspx?KeyWord=' + dat
}

	
	
function showHideInfo(shID) {
	if (document.getElementById(shID)) {
		if (document.getElementById(shID+'-show').style.display != 'none') {
			document.getElementById(shID+'-show').style.display = 'none';
			document.getElementById(shID).style.display = 'block';
		}
		else {
			document.getElementById(shID+'-show').style.display = 'inline';
			document.getElementById(shID).style.display = 'none';
		}
	}
}


//checks all DataGrid CheckBoxes with the given name with the given value
    function CheckAllDataGridCheckBoxes(aspCheckBoxID, checkVal) {

         // re = new RegExp(':' + aspCheckBoxID + '$')  //generated control name starts with a colon
         re = new RegExp('.*' + aspCheckBoxID)

        for(i = 0; i < document.forms[0].elements.length; i++) {

            elm = document.forms[0].elements[i]

            if (elm.type == 'checkbox') {

                if (re.test(elm.name)) {

                    elm.checked = checkVal

                }
            }
        }
    }
    
    
function ValidateChecked(obj,tbid) 
		{
		    var cb = document.getElementById(obj);
		    var tb = document.getElementById(tbid);
    		
		    if (cb.checked == false)  	
		        {		   	                
			        tb.value=''	  ; 	    
		        }		   	            
		    else			   	        
		        {			            
			        tb.value='I Agree'	;    
		        }			            
		}



  function isNumberKey(evt)
  {
     var charCode = (evt.which) ? evt.which : event.keyCode
     if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;

     return true;
  }
  

    
    
    




