function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
$(function(){
	if(jQuery.browser.msie && parseInt(jQuery.browser.version) <= 6){
		var content = '<div id="ffdownload"><a id="ffdl" href="http://www.mozilla.com/en-US/?from=sfx&amp;uid=275157&amp;t=456">Download Firefox - Free</a><div id="ffwar"><span>WARNING - Incompatible browser detected</span>We have detected that you are using an old and an unsafe browser IE v'+jQuery.browser.version+' which cannot render this website correctly. To view this website to its full potential please switch to a FREE and a secure browser <a href="http://www.firefox.com/" target="_blank">Firefox</a>. To close this warning <a id="ffclose" href="#">click here</a>.</div></div>';
		$('body').find('div:first').before(content);
		$("a#ffclose").click(function(){$("div#ffdownload").fadeOut("slow")});
	}
	$('#menu ul a').collapsor();
/* Start the code for Fancy Scrolling*/
  function filterPath(string) {
  return string
	.replace(/^\//,'')
	.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
	.replace(/\/$/,'');
  }
  var locationPath = filterPath(location.pathname);
  $('a[href*=#]').each(function() {
	var thisPath = filterPath(this.pathname) || locationPath;
	if (  locationPath == thisPath
	&& (location.hostname == this.hostname || !this.hostname)
	&& this.hash.replace(/#/,'') ) {
	  var $target = $(this.hash), target = this.hash;
	  if (target) {
		var targetOffset = $target.offset().top;
		$(this).click(function(event) {
		  event.preventDefault();
		  $('html, body').animate({scrollTop: targetOffset}, 400, function() {
			location.hash = target;
		  });
		});
	  }
	}
  });
/* End the code for Fancy Scrolling */
});//$(document).ready closed
function isNumberKey(evt)
{
	 var charCode = (evt.which) ? evt.which : event.keyCode;
	 if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;
     return true;
}
function isAlphabetKey(evt)
{
	 var charCode = (evt.which) ? evt.which : event.keyCode;
	 if ( (charCode >= 33 || charCode  == 45 || charCode  == 46) && (charCode < 65 || charCode > 91) && (charCode < 97 || charCode > 122))
            return false;
     return true;
}
function isValidUsername(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode;
	//alert(charCode);
	//0-9 = 48-57
	//A-Z = 65-90
	//a-z = 97-122
	// _  = 95
	 if( (charCode>=48 && charCode<=57) || (charCode>=97 && charCode<=122) ||  charCode == 95)
		 return true;
     return false;
}
function validateEmail(val)
{
	if ( !((/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i).test(val)) )
		return false;
	else
		return true;
}
function restrictLength(evt,lmt,cln)
{
	var charCode = (evt.which) ? evt.which : event.keyCode;
	if(charCode == 8 || charCode == 13)	return true;
	else if(cln >= lmt)	return false;
	else	return true;
}
function doRow(val, rowObj) {
	if(val)
		$(rowObj).addClass('rowSelected');
	else
		$(rowObj).removeClass('rowSelected');
}
