	function toggleObject(obj) {
		var el = document.getElementById(obj);
		if ( el.style.display != "none" ) {
			el.style.display = 'none';
		}else {
			el.style.display = '';
		}
	}
	
	//hides an object such as div/table/etc
	function hideObject(obj) {
		var el = document.getElementById(obj);
		if(el != null) el.style.display = 'none';
	}	 
	
	//hides an object such as div/table/etc
	function showObject(obj) {
		var el = document.getElementById(obj);
		if(el != null) el.style.display = '';
	}

	
	function selectAll(formObj, isInverse){
   		for (var i=0;i < formObj.length;i++){
      		fldObj = formObj.elements[i];
      		if (fldObj.type == 'checkbox'){ 
         		if(isInverse) fldObj.checked = (fldObj.checked) ? false : true;
         		else fldObj.checked = true; 
			}
   		}
   	}
	
	function bookmarksite(title,url){
		if (window.sidebar) // firefox
			window.sidebar.addPanel(title, url, "");
		else if(window.opera && window.print){ // opera
			var elem = document.createElement('a');
			elem.setAttribute('href',url);
			elem.setAttribute('title',title);
			elem.setAttribute('rel','sidebar');
			elem.click();
		} 
		else if(document.all)// ie
			window.external.AddFavorite(url, title);
	}
	
	function pausecomp(millis){
		var date = new Date();
		var curDate = null;

		do { curDate = new Date(); }
			while(curDate-date < millis);
	}
	
	function toggle_bulk(original_control, hidden_control, link_control){

		//toggle the original control disabled property
		tmp = document.getElementById(original_control);
		tmp.disabled = (tmp.disabled ? false : true);
	
		//toggle the hidden layer
		tmp = document.getElementById(hidden_control);
	
		if ( tmp.style.display != "none" ) {
			//control is not hidden, lets hide it
			hideObject(hidden_control);
			
			//toggle the plus/minus
			document.getElementById(link_control).innerHTML = "+";
			
			document.getElementById(original_control).focus();
		}else{
			//control is hidden, lets show it
			showObject(hidden_control);
			
			//toggle the plus/minus
			document.getElementById(link_control).innerHTML = "-";
			
			document.getElementById(hidden_control).focus();
			
	
		}

	}
	
	//clicks a button when enter is clicked on a text box
	function process_key(e, submit_button){
		
		var key_num;
		
		if(window.event) {
			key_num = e.keyCode;
		}else if(e.which){
			key_num = e.which;
  	    }

		if(key_num == 13){

			submit_button.click();

			return false; 
			
		}
		
		return true;
		
	}
	
function clickLink(linkobj) {
     if (linkobj.getAttribute('onclick') == null) {
          if (linkobj.getAttribute('href')) document.location = linkobj.getAttribute('href');
     }
     else linkobj.onclick();
}
	
      // Cross-browser implementation of element.addEventListener()
	function add_listener(element, type, expression, bubbling){
		
		bubbling = bubbling || false;
		if(window.addEventListener) { // Standard
			element.addEventListener(type, expression, bubbling);
			return true;
		} else if(window.attachEvent) { // IE
			element.attachEvent('on' + type, expression);
			return true;
		} else return false;
		
	}
	  
	function sayhi(){
		alert("hi");
	}
	
	//gets a string between a string
	function gbs(str_in, str_start, str_end){
	
		var m_start = str_in.indexOf(str_start, 0);
		var m_end = str_in.indexOf(str_end, m_start + str_start.length);
		
		if(m_start == -1 || m_end == -1 || m_start > m_end){
			return "";
		}else{
			return str_in.substr(m_start + str_start.length, m_end - (m_start + str_start.length));
		}
	
	}
	
	//creates a leading zero on numbers < 10
	function format_number_leading_zero(num_in){

		if(num_in < 10){
			return "0" + num_in;
		}else{
			return num_in;
		}
		
	}
	
	function calculate_date(offset){
		
		var now = new Date();
		now.setDate(now.getDate() + offset);
		
		return now.getFullYear() + "-" + format_number_leading_zero(now.getMonth()+1) + "-" + format_number_leading_zero(now.getDate());
		
	}
	
	function change_status(str_in){
		window.status = str_in;
	}
	
	//rotates 
	function rotate_table_rows(table){
				
		for (var i=1; i<table.rows.length; i++) {
		
			if(i % 2 == 0){
				table.rows[i].bgColor="#FFFFFF";
			}else{
				table.rows[i].bgColor='#F8F8F8';
			}
		  
		}

	}
	
	//shows a popup balloon explaining some type of feature
	function explain(type, source, language){
		
		var message = "";
		
		//convert to lower case for standarization
		type = type.toLowerCase();
		source = source.toLowerCase();
		language = language.toLowerCase();
		
		if(source == 'column' && (language == null || language == 'en' || language == '')){
			
			if(type == "domain"){
				message = '<b>Domain:</b> The domain name you have queried.<br><br>This column can be sorted by clicking on it.';
			}else if(type == "words"){
				message = '<b>Word(s):</b> The words extracted from the domain name, also known as phrase (ex: fastcars.com => fast cars).<br><br>This column can be sorted by clicking on it.';
			}else if(type == "availability"){
				message = '<b>Availability:</b> The DNS level availability of the domain. Please note that DNS checks can be up to one hour delayed and may not reflect live availability so click on the row item to check the live registration status.';
			}else if(type == "live_availability"){
				message = '<b>Live Availability(s):</b> The live availability of this domain.';
			}else if(type == "multi_availability"){
				message = '<b>TLDs:</b> The registration status of major extensions (ex: com/net/org/info/biz/us) expressed as percentage of registered domains (ex: if all extensions are taken then result is 100%).<br><br>This column can be sorted by clicking on it.';								
			}else if(type == "serp"){
				message = '<b>SERP:</b> Search engine results for phrase with quotes (ex: fastcars.com => \'fast cars\').<br><br>This column can be sorted by clicking on it.';				
			}else if(type == "ads"){				
				message = '<b>Ads:</b> The number of ads displayed for the phrase results in the search engine.<br><br>This column can be sorted by clicking on it.';
			}else if(type == "alexa"){
				message = '<b>Alexa:</b> The Alexa traffic rank for this domain.<br><br>This column can be sorted by clicking on it.';				
			}else if(type == "pagerank"){
				message = '<b>PR:</b> The Google pagerank for the specified domain.<br><br>This column can be sorted by clicking on it.';				
			}else if(type == "searches"){
				message = '<b>Searches:</b> The average monthly search volume for the [exact] phrase.<br><br>This column can be sorted by clicking on it.';				
			}else if(type == "cpc"){
				message = '<b>CPC:</b> The average cost per click for the [exact] phrase.<br><br>This column can be sorted by clicking on it.';				
			}else if(type == "popular_month"){
				message = '<b>Popular Month:</b> The month with the highest search volumes for this phrase.';								
			}else if(type == "wtc"){
				message = '<b>WTC:</b> The Word Tracker score for the domain with extension.<br><br>This column can be sorted by clicking on it.';								
			}else if(type == "ovt"){
				message = '<b>OVT:</b> The archived Overture score for the domain with extension. Since Overture no longer provides data this metric is pulled from an archive.<br><br>This column can be sorted by clicking on it.';
			}else if(type == "appraisal"){
				message = '<b>Appraisal:</b> The estimated value of this domain name.<br><br>This column can be sorted by clicking on it.';								
			}else if(type == "gpf"){
				message = '<b>GPF:</b> Google Phrase Frequency. The number of items that show up for the specified phrase.';								
			}
			
			if(message != '') Tip(message, BALLOON, true, ABOVE, true)
			
		}
		
	}
	
	function change_object_class(item_name, class_name) {

		var item_object = document.getElementById(item_name);

		item_object.setAttribute("class", class_name);
		item_object.setAttribute("className", class_name);

		return;
	}
	
	function gray_out(vis, options) {
		// Pass true to gray out screen, false to ungray
		// options are optional.  This is a JSON object with the following (optional) properties
		// opacity:0-100         // Lower number = less grayout higher = more of a blackout 
		// zindex: #             // HTML elements with a higher zindex appear on top of the gray out
		// bgcolor: (#xxxxxx)    // Standard RGB Hex color code
		// grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
		// Because options is JSON opacity/zindex/bgcolor are all optional and can appear
		// in any order.  Pass only the properties you need to set.
		var options = options || {}; 
		var zindex = options.zindex || 50;
		var opacity = options.opacity || 70;
		var opaque = (opacity / 100);
		var bgcolor = options.bgcolor || '#000000';
		var dark=document.getElementById('darkenScreenObject');
		if (!dark) {
		// The dark layer doesn't exist, it's never been created.  So we'll
		// create it here and apply some basic styles.
		// If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
		var tbody = document.getElementsByTagName("body")[0];
		var tnode = document.createElement('div');           // Create the layer.
			tnode.style.position='absolute';                 // Position absolutely
			tnode.style.top='0px';                           // In the top
			tnode.style.left='0px';                          // Left corner of the page
			tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
			tnode.style.display='none';                      // Start out Hidden
			tnode.id='darkenScreenObject';                   // Name it so we can find it later
		tbody.appendChild(tnode);                            // Add it to the web page
		dark=document.getElementById('darkenScreenObject');  // Get the object.
		}
		if (vis) {
		// Calculate the page width and height 
		if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
			var pageWidth = document.body.scrollWidth+'px';
			var pageHeight = document.body.scrollHeight+'px';
		} else if( document.body.offsetWidth ) {
		  var pageWidth = document.body.offsetWidth+'px';
		  var pageHeight = document.body.offsetHeight+'px';
		} else {
		   var pageWidth='100%';
		   var pageHeight='100%';
		}   
		//set the shader to cover the entire page and make it visible.
		dark.style.opacity=opaque;                      
		dark.style.MozOpacity=opaque;                   
		dark.style.filter='alpha(opacity='+opacity+')'; 
		dark.style.zIndex=zindex;        
		dark.style.backgroundColor=bgcolor;  
		dark.style.width= pageWidth;
		dark.style.height= pageHeight;
		dark.style.display='block';                          
		} else {
		 dark.style.display='none';
		}
	}