//genric scripts file

/**
Basic email validattion
*/
function isEmailValid(email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   //var address = document.forms[form_id].elements[email].value;
   if(reg.test(email) == false) {
      //alert('Invalid Email Address');
      return false;
   }
   return true;
}

function bookmark(url,title) {
	if((navigator.appName == 'Microsoft Internet Explorer') && (parseInt(navigator.appVersion) >= 4)) {
		window.external.AddFavorite(url,title);
	} else if(navigator.appName == 'Netscape') {
		window.sidebar.addPanel(title,url,'');
	} else {
		alert('Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark');
	}
}

$(document).ready(function() {
   $('a[rel*=facebox]').facebox();

   $('#bookmarkThisPage a').click(function(){
		bookmark(document.location,document.title);
		return false;
   });

   /* Toggling sitemap and idg network in footer */
	$('#footerBlockLinksNav h2 a').click(function() {
		$('#footerBlockLinks .footerToggleContainer').hide();
		$('#footerBlockLinks #'+$(this).attr('rel')).show();		
		$(this).parent().addClass('active').siblings().removeClass('active');		
		return false;		
	});
	
	/* For the site map drop down in header, on change and on submit */
	$('#siteMapDropDownForm select').change(function() {
		var url = $.Trim($(this).val()); 							
		if(url != "")
			window.location.href = url;
	});
	
	$('#siteMapDropDownForm').submit(function() {
		var url = $.Trim($('#sitemapdropdownform select').val()); 							
		if(url != "")
			window.location.href = url;
		
		return false;
	});
});
