//--------
//Common
//--------
//
//onload - functions
/*
window.onload = function()  
{

}
*/
//-->
function init() {
    $("#mainContentRightColumnInnerRight").height($("#mainContentRightColumn").height() - 40);
}
//
//Validate Email address
function validEmail(email) {
  var emailReg = "^[^_.]([a-zA-Z0-9_]*[.]?[a-zA-Z0-9_]+[^_]){1}@{1}[a-z0-9/-]+[.]{1}(([a-z]{2,3})|([a-z]{2,3}[.]{1}[a-z]{2,3}))$";
  var regex = new RegExp(emailReg);
  return regex.test(email);
}
//-->
//
//Set style
function setStyle(sElementId, sStyleAtt, sStyleVal) {
    $("#" + sElementId).css(sStyleAtt, sStyleVal);
}
//
//
//Validate Email Address
function validateEmailAddress(sEmailField) {
    var emailstring = $("#" + sEmailField).val();
    var ampIndex = emailstring.indexOf("@");
    var afterAmp = emailstring.substring((ampIndex + 1), emailstring.length);
    var dotIndex = afterAmp.indexOf(".");
    dotIndex = dotIndex + ampIndex + 1;
    afterAmp = emailstring.substring((ampIndex + 1), dotIndex);
    var afterDot = emailstring.substring((dotIndex + 1), emailstring.length);
    var beforeAmp = emailstring.substring(0, (ampIndex));
    var email_regex = /^\w(?:\w|-|\.(?!\.|@))*@\w(?:\w|-|\.(?!\.))*\.\w{2,3}/
    if ((emailstring.indexOf("@") != "-1") &&
		(emailstring.length > 5) &&
		(afterAmp.length > 0) &&
		(beforeAmp.length > 1) &&
		(afterDot.length > 1) &&
		(email_regex.test(emailstring))) {
        setStyle(sEmailField, "background-color", "#FFF");
        return true;
    } else {
        setStyle(sEmailField, "background-color", "#FFCCCC");
        return false;
    }
}
//
//
/*
 * EqualHeight 1.0
 *
 * Requires the dimensions plug-in (.outerHeight())
 *
 * Copyright (c) 2007 Andreas Lagerkvist (exscale.se)
 */
jQuery.fn.equalHeight = function()
{
	var maxHeight = 0;

	// Store the tallest element's height
	this.each(function()
	{
		var height = jQuery(this).outerHeight();
		maxHeight = (height > maxHeight) ? height : maxHeight;
	});

	// Always return each...
	return this.each(function()
	{
		// Set element's min-height to tallest element's height
		var mh = maxHeight - parseInt(jQuery(this).css('paddingBottom'), 10) - parseInt(jQuery(this).css('paddingTop'), 10);
		jQuery(this).css({minHeight: mh +'px'});

		/* Use this code if you care about IE<7
		// Adjust all elements' bottom padding to make them equal height (why do this instead? for IE6 perhaps...)
		var pb = maxHeight - jQuery(this).outerHeight() + parseInt(jQuery(this).css('paddingBottom'), 10);
		jQuery(this).css({paddingBottom: pb +'px'});
		*/
	});
};
//-->
//Handle Site Search
function handleSiteSearch(){
	if($('#tbSearch').val() !== ''){
		$('#frmSearch').submit();
	}else{
		$('#tbSearch').attr("style","background-color:#FFD79B;");
	}
}
//
//
//Initialize Lightbox
function initializeLightbox() {
    $('a.lightbox').lightBox({
        imageLoading: '/images/lightbox/lightbox-ico-loading.gif',
        imageBtnClose: '/images/lightbox/lightbox-btn-close.gif',
        imageBtnPrev: '/images/lightbox/lightbox-btn-prev.gif',
        imageBtnNext: '/images/lightbox/lightbox-btn-next.gif'
    });
}
//
//-->


