	var min=8;
var max=18;
function increaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }

}  

function decreaseFontSize() {
	
   var p = document.getElementsByTagName('p');
   
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }   
}

function changeLanguage() {
}



function check_all()
{
    // var boxy = document.getElementById('option_value').checked='checked';
	var checks = document.getElementsByName('option_value');
    var boxLength = checks.length;
	for ( i=0; i < boxLength; i++ ) {
        checks[i].checked = true;
      } 

}

function uncheck_all()
{
var checks = document.getElementsByName('option_value');
    var boxLength = checks.length;
	for ( i=0; i < boxLength; i++ ) {
        checks[i].checked = false;
      } }

function viewSavedAddress() {
window.open('../savedResults.php','mywin',
'left=20,top=20,width=760,height=500,toolbar=1,resizable=0');

}

function saveSelected() {
var c_value = "";
var checks = document.getElementsByName('option_value');
var boxLength = checks.length;
//alert(boxLength);

for (var i=0; i < boxLength; i++)
   {
   if (checks[i].checked == true)
      {
	  c_value = checks[i].value;
	  //alert(c_value);
      //c_value = c_value + document.checkBoxes.option_value[i].value;	  
	  saveCompany(c_value);
	  
      }
	c_value = "";  
   }
   

$.jGrowl("<strong style='color:#000'><a href='savedResults.php' style='font-weight:bold'>Click here</a> or on <img align='absmiddle' src='images/savedcompanies.jpg' /> View Saved Information to export or view.</strong> ", { header: 'Company Information Saved',life: 10000 });
}

function saveCompany(val)
{
   var url = 'cid=' + val;

   $.ajax({
   type: "GET",
   url: "saveCompany.php",
   data: url,
   success: function(){
   
	//
   }
 });


}

function saveSeparate(val) {
		var url = 'cid=' + val;

   $.ajax({
   type: "GET",
   url: "saveCompany.php",
   data: url,
   success: function(){
   
	$.jGrowl("<a href='savedResults.php'><strong style='color:#000'>Click here or on '<img align='absmiddle' src='images/savedcompanies.jpg' /> View Saved Information' to export or view.</strong></a> ", { header: 'Company Information Saved',life: 10000 });
   }
 });
}





function get_check_value()
{
var c_value = "";
var checks = document.getElementsByName('option_value');
var boxLength = checks.length;

for (var i=0; i < boxLength; i++)
   {
   if (checks[i].checked == true)
      {
	  c_value = checks[i].value;
	  //alert(c_value);
      c_value = c_value + document.checkBoxes.option_value[i].value;	  
	  saveAddress(c_value);
      }
	c_value = "";  
   }
   var answer = confirm ("Details were saved. Would you like to view saved company details?")
	if (answer)
	window.open('../savedResults.php','mywin','left=20,top=20,width=760,height=500,toolbar=1,resizable=0');
	else
	cur="";
}




// this function is needed to work around 
  // a bug in IE related to element attributes
  function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     return result;
  }   

 function stripe(id) {
//alert(id);
    // the flag we'll use to keep track of 
    // whether the current row is odd or even
    var even = false;
  
    // if arguments are provided to specify the colours
    // of the even & odd rows, then use the them;
    // otherwise use the following defaults:
    var evenColor = arguments[1] ? arguments[1] : "#fff";
    var oddColor = arguments[2] ? arguments[2] : "#eee";
  
    // obtain a reference to the desired table
    // if no such table exists, abort
    var table = document.getElementById(id);
    if (! table) { return; }
    
    // by definition, tables can have more than one tbody
    // element, so we'll have to get the list of child
    // &lt;tbody&gt;s 
    var tbodies = table.getElementsByTagName("tbody");

    // and iterate through them...
    for (var h = 0; h < tbodies.length; h++) {
    
     // find all the &lt;tr&gt; elements... 
      var trs = tbodies[h].getElementsByTagName("tr");
      
      // ... and iterate through them
      for (var i = 0; i < trs.length; i++) {

        // avoid rows that have a class attribute
        // or backgroundColor style
        if (! hasClass(trs[i]) &&
            ! trs[i].style.backgroundColor) {
 		  
          // get all the cells in this row...
          var tds = trs[i].getElementsByTagName("td");
        
          // and iterate through them...
          for (var j = 0; j < tds.length; j++) {
        
            var mytd = tds[j];

            // avoid cells that have a class attribute
            // or backgroundColor style
            if (! hasClass(mytd) &&
                ! mytd.style.backgroundColor) {
        
              mytd.style.backgroundColor =
                even ? evenColor : oddColor;
            
            }
          }
        }
        // flip from odd to even, or vice-versa
        even =  ! even;
      }
    }
  }
  
  
function increaseFont() {
	var dsi=16;
	content = document.getElementById('mainContent');
	content.style.fontSize='medium';
}

function deleteChecked()
{
var c_value = "";
var checks = document.getElementsByName('option_value');
var boxLength = checks.length;

for (var i=0; i < boxLength; i++)
   {
   if (checks[i].checked == true)
      {
	  c_value = checks[i].value;
	  //alert(c_value);
      //c_value = c_value + document.checkBoxes.option_value[i].value;	  
	
	  finishDelete(c_value);
      }
	c_value = "";  
   }
  refreshPage(); 
}

function finishDelete(c_value) {
	var url    = 'deleteChecked.php';
	var pars   = 'cid=' + c_value;
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars} );
}

function clearAll() {
	var url    = 'clearAll.php';	
	var myAjax = new Ajax.Request( url, {method: 'get'} );
	refreshPage();
}

function refreshPage() {
	window.location.reload();
}
function smartSwap(option) {
   //document.getElementById('smartcategories').innerHTML = '';
   //$("#smartcategories").hide('fold');
   $("#smartcategories").html('<img src="images/loading.gif" /><p>Please wait...Loading</p>');	
   var url = 'categoryID=' + option;
   $.ajax({
   type: "GET",
   url: "smartcategories.php",
   data: url,
   success: function(content){	   
	   $("#smartcategories").html(content);
       
	//
   }
 });
	
	
}

/*function smartSwap(cat) {
new Effect.Opacity('category', { from: 1.0, to: 0, duration: 0.8 , afterFinish:completeSwap  });
}*/	

function loadPage(domain) {
if(domain == 'N/A' || domain == 'nil' )   {
	//alert("Website Unavailable For This Company");
	$.jGrowl("", { header: 'Website Unavailable For This Company', life: 6000 });

}
else {
	var subst = domain.substring(0,1);	
	//alert(subst);
	if(subst == 'w') {
	
	var load = window.open('http://'+domain,'','scrollbars=no,menubar=yes,height=600,width=800,resizable=yes,toolbar=yes,location=yes,status=yes');
	}
	else if(subst != 'h') {
		var load = window.open('http://www.'+domain,'','scrollbars=no,menubar=yes,height=600,width=800,resizable=yes,toolbar=yes,location=yes,status=yes');
	}
	
	
	else {
	var load = window.open(domain,'','scrollbars=no,menubar=yes,height=600,width=800,resizable=yes,toolbar=yes,location=yes,status=yes');
	
	}

}

}


function displayDetails(id) {
	//alert(id);
	url = 'displayDetails.php?id='+id;
	window.open (url,
"mywindow","status=1,toolbar=0,scrollbars=1");
	//window.open('displayDetails.php?id='+id,'Details','left=20,top=20,width=800,height=500,toolbar=0,resizable=0,scrollbars=1');

}