$(document).ready(function(){
	//content columns equal height
	/*if(jQuery('#leftColumn, #rightColumn')[0]){
		jQuery('#leftColumn, #rightColumn').equalHeight();
	}*/
	
	if(jQuery('#thisSubPage')[0]){
		jQuery('#thisSubPage').parent().parent().removeAttr('id');
	}
	/*
	//MSIE table header rotation
	if ($.browser.msie){
		$('.order .canv').each(function(){
			//this.style.filter = "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";
			//this.style.whiteSpace = "pre";
			//this.height = '20px';
		});
	}
	
	if ($.browser.safari || $.browser.chrome){
		//$('.obj').css({ marginBottom: '-40px'})
	}*/
	
	
	//text hints
	if(jQuery('input')[0]){
		$('input').hint();
	}
	
	//table zebra
	if(jQuery('table.tabular')[0]){
		$('table.tabular tr:odd td').css({"background-color":"#fff"});
		$('table.tabular.impar tr:even td').css({"background-color":"#fff"});
		$('table.tabular.impar tr:odd td').css({"background-color":"transparent"});
	}
	
	//Hide div w/id other_documents
   jQuery("#other_documents").css("display","none");
   jQuery("#show_more").click(function(){

    if (jQuery("#show_more").is(":checked")){
        jQuery("#other_documents").show("fast");
    }
    else{     
        jQuery("#other_documents").hide("fast");
    }
  });
  
   jQuery("#required_export_5").click(function(){

    if (jQuery("#required_export_5").is(":checked")){
        jQuery("#other_documents").show("fast");
    }
    else{     
        jQuery("#other_documents").hide("fast");
    }
  });
  
  
  
  //Validation
  jQuery("#registrationForm").validate();
  
  jQuery('.inpQ').numeric();
  
  jQuery('#uid42').change(function() {
	  if (jQuery('#uid42 option:selected').val()=='Webmaster') {
	  	jQuery('input#uid617').val('ssmit@idafoundation.org');
	  } else {
	  	jQuery('input#uid617').val('bcahuzak@idafoundation.org');
	  }
	  });
	  
  jQuery('#uid447').change(function() {
	  if (jQuery('#uid447 option:selected').val()=='Webmaster') {
	  	jQuery('input#uid618').val('ssmit@idafoundation.org');
	  } else {
	  	jQuery('input#uid618').val('bcahuzak@idafoundation.org');
	  }
	  });
	  
  jQuery('#uid473').change(function() {
	  if (jQuery('#uid473 option:selected').val()=='Webmaster') {
	  	jQuery('input#uid619').val('ssmit@idafoundation.org');
	  } else {
	  	jQuery('input#uid619').val('bcahuzak@idafoundation.org');
	  }
	  });
});

function integerInput(e,inputElement)
{
    var keynum
    var keychar
    var numcheck
    if(window.event) // IE
    {
        keynum = e.keyCode
    }
    else if(e.which) // Netscape/Firefox/Opera
    {
        keynum = e.which
    }
    keychar = String.fromCharCode(keynum)
    re = new RegExp('[a-zA-Z0-9\.]');
    if(!keychar.match(re) && keynum != 8 && keynum != null) return false;
    return true;
}

/*
 * Special Tooltip 
 * (using qTip)
 */
jQuery(function($) {
	$('#order-detail th, #order-shipment th, .order th').qtip({		
   		show: 'mouseenter',
   		hide: 'mouseleave',
   		style: { 
      			name: 'blue',
      			background: '#15257F',
      			color: '#ffffff',
      			border: {
         			width: 7,
         			radius: 5,
         			color: '#15257F'
      			},
      			tip: 'bottomLeft'

   		},
   		position: {
     			corner: {
         			target: 'topRight',
         			tooltip: 'bottomLeft'
      			},
      			adjust: {
      				x: -10,
      				y: 10
      			}
   		}
   		

	});
});
