﻿$(document).ready(function(){
    
    //called when key is pressed in textbox
	$(".numeric").keypress(function (e)  
	{ 
	  //if the letter is not digit then display error and don't type anything
	  if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))
	  {
	    return false;
      }	
	});
	
	//Bind Tooltips
	$(".tooltip").tooltip({ 
		showURL: false
	});
	
	//PNG Fix
	$("img[@src$=png], #imageid").pngFix();
	
	//Load SWF
	swfobject.embedSWF(jsAppPath + "Images/786x273.swf", "flash", "786", "273", "9.0.0");
	
});

function str_replace_reg(haystack, needle, replacement) {
    var r = new RegExp(needle, 'g');
    return haystack.replace(r, replacement);
}

function SetUniqueRadioButton(nameregex, current)
{
   re = new RegExp(nameregex);
   for(i = 0; i < document.forms[0].elements.length; i++)
   {
      elm = document.forms[0].elements[i]
      if (elm.type == 'radio')
      {
         if (re.test(elm.name))
         {
            elm.checked = false;
         }
      }
   }
   current.checked = true;
}