// JavaScript Document

var firstTime = true;
function changeFontSize(element,step)
{

	if (document.getElementById(element)) {
		var el = document.getElementById(element);
		//alert('exists');
	}
	if (firstTime) {
		var curFont = 13;
		el.style.fontSize = (curFont) + 'px';
		firstTime = false;
		step = parseInt(step,10);
		var curFont = parseInt(el.style.fontSize,10);
		el.style.fontSize = (curFont+step) + 'px';
	}else if (!firstTime) {
		step = parseInt(step,10);
		var curFont = parseInt(el.style.fontSize,10);
		el.style.fontSize = (curFont+step) + 'px';
	}
	//alert(el.style.fontSize);
}

function resetFontSize(element,value)
{

	if (document.getElementById(element)) {
		//alert("rest");
		var el = document.getElementById(element);
		//alert('index detected');
		el.style.fontSize = (value) + 'px';
	}
}

function selectAll(id){
    document.getElementById(id).focus();
    document.getElementById(id).select();
}

function hasClass(ele,cls) {
	return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}

function stripe() {

    // 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;
    var tables = document.getElementsByTagName("table");
	// Modified by rob to take all tables because there are mnore than one table on pagesa 
	// and getelementbyid will only return the first one. Should test to make sure that the table 
	// has the proper id.
	
	for (var t = 0; t < tables.length; t++) {
		table = tables[t];
    if (table.className == "nostripe") { 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;
      }
    }
   }
}
  



	
	if(stripe){
		//alert("yup");
		window.onload = stripe;
	}
	
function validateLogin()
{
	/*var returnvalue = true;
	errormessage = "";
	if (isEmpty(document.getElementById('name'),"Please enter your user name")){ returnvalue = false;}
	if (isEmpty(document.getElementById('phone'),"Please enter your user phone number")){ returnvalue = false;}
	if (isEmpty(document.getElementById('email'),"Please enter your email address")){ returnvalue = false;}
	//if (!document.getElementById('terms').checked){ returnvalue = false;}
	/////////////
	if (returnvalue) return true;
	alert("yes");
	else
	{
		return false;
		alert("no");
	}*/
	
	if(document.getElementById('name').value == "" || document.getElementById('email').value == "" || document.getElementById('phone').value == "" || !document.getElementById('terms').checked){
		alert("Please fill out all the required fields (noted by an *)");
		return false;
	}else {
		return true;	
	}
	
}

