// all scripts at the bottom of the page should be added here

/*	this is to add class on "a" w/ submenu for p7mon support
	just change #main-menu to whatever parent class or id of the p7menu
	Revome script if not using p7menu
	Revome script if using p7 tab menu
jQuery("#main-menu ul li:has(ul) > a").addClass("p7PMtrg"); */

j = jQuery.noConflict();

/* Annoucements (News) */

j('.news-item:eq(0)').append('<br/>');

j('.news-item').each(function()
{
	var href = j(this).find('a:eq(0)').attr('href');
	j(this).find('.withimage').attr('href', href);
});

/* Forms */

j('#WorkPhone').numeric(); //Make Phone input accept only numeric values
j('#HomePhone').numeric(); 
j('#CellPhone').numeric(); 

window.alert = function(message){

var sub = message.split('\n');
var output = '';

for(var count = 0; count < sub.length; count++)
{
    sub[count] += '<br/>';
    output += sub[count];
}
 
j.prompt(output); 
}

/* Equal Height */

function equalHeight(group) {
   tallest = 0;
   group.each(function() {
      thisHeight = j(this).height();
      if(thisHeight > tallest) {
         tallest = thisHeight;
      }
   });
   group.height(tallest);
}

equalHeight(j(".desc"));
equalHeight(j(".typedesc"));
equalHeight(j(".typeheader"));

equalHeight(j(".vehiclecontainer"));

/* Hide Empty Content */
/* Testimonial */
var content = jQuery('.testimonial #testi').text();
var trimmed = jQuery.trim(content);
if(trimmed == "")
jQuery('.testimonial').hide();

/* Latest News */
var link = jQuery('.latestnews .middle a').text();
var content = jQuery('.latestnews .middle p').text();
var trimmed = jQuery.trim(link);
var trimmed1 = jQuery.trim(content);
if(trimmed == "" && trimmed1 == "")
jQuery('.latestnews').hide();
