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_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_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 ReplaceApostrophe()
{
	var key = window.event.keyCode;
	if (key == 39)
	{
		window.event.keyCode = 96;
		return;
	}
	else
	{
		return;
	}
}

function EnsureNumeric()
{
	//Function: To restrict the entry to numeric characters
	// Get ASCII value of key that user pressed
	var key = window.event.keyCode;

	// Was key that was pressed a numeric character (0-9)?
	if (key == 46)
	{
		return;		
	}
	else if ( key > 47 && key < 58 )
	{
		return; // if so, do nothing
	}
	else
	{
		window.event.returnValue = null; // otherwise, discard character
	}
}

function Convert_Date(D_Date)
{
	var Date_Char, Final_Date_Char
	var Check_Char = D_Date.charAt(2);
	if (Check_Char == "/")
	{
		Date_Char = D_Date.split("/");
		Final_Date_Char = Date_Char[0];
		Final_Date_Char += "-";
		if(Date_Char[1] == "01")
		{
			Final_Date_Char += "JAN";
		}
		else if(Date_Char[1] == "02")
		{
			Final_Date_Char += "FEB";
		}
		else if(Date_Char[1] == "03")
		{
			Final_Date_Char += "MAR";
		}
		else if(Date_Char[1] == "04")
		{
			Final_Date_Char += "APR";
		}
		else if(Date_Char[1] == "05")
		{
			Final_Date_Char += "MAY";
		}
		else if(Date_Char[1] == "06")
		{
			Final_Date_Char += "JUN";
		}
		else if(Date_Char[1] == "07")
		{
			Final_Date_Char += "JUL";
		}
		else if(Date_Char[1] == "08")
		{
			Final_Date_Char += "AUG";
		}
		else if(Date_Char[1] == "09")
		{
			Final_Date_Char += "SEP";
		}
		else if(Date_Char[1] == "10")
		{
			Final_Date_Char += "OCT";
		}
		else if(Date_Char[1] == "11")
		{
			Final_Date_Char += "NOV";
		}
		else if(Date_Char[1] == "12")
		{
			Final_Date_Char += "DEC";
		}
		Final_Date_Char += "-";
		Final_Date_Char += Date_Char[2];
		
		return Final_Date_Char;
	}
	else if (Check_Char == "-")
	{
		return D_Date.toUpperCase();
	}
	else if (D_Date == "")
	{
		return "";
	}
	else
	{
		alert("Invalid Date! Please Use The Format DD/MM/YYYY or DD-MMM-YYYY");
		return "";
	}
}

function Remove_Company(ID)
{
	var D_Link;
	input_box=confirm("Are You Sure You Want To Remove This Link?");
	if (input_box == true)
	{ 
		D_Link = "Account_Links_Edit.asp?ID="
		D_Link += ID;
		D_Link += "&MODE=DEL";		
		document.form1.action = D_Link;
		document.form1.submit();
	}
}

function Add_Company(ID)
{
	var D_Link;
	input_box=confirm("Are You Sure You Want To Add This Link?");
	if (input_box == true)
	{ 
		D_Link = "Account_Links_Edit.asp?ID="
		D_Link += ID;
		D_Link += "&MODE=ADD";
		//alert(D_Link);
		document.form1.action = D_Link;
		document.form1.submit();
	}
}