// Google Analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-26956918-1']);
_gaq.push(['_trackPageview']);

(function () {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

//Refreshing the screen
var bolRefresh = false;
var refreshPage = '';
//setTimeout("RefreshRequired();",60000); 

function RefreshRequired()
{
	if(bolRefresh) 
	{	
		switch(refreshPage)
		{
			//Special refresh settings
		 	case 'FirstCommunion':
				refreshFirstCommunion();
				break;
			default:
				OpenPage(refreshPage,'');
				break;
		}
	}
}


//onLoad method for this page
function page_onLoad(requestID)
{
	checkBrowser();
}

function findObj(n, d) { //object ID function for multiple browsers
	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=findObj(n,d.layers[i].document);
	if(!x && d.getElementById) 
		x=d.getElementById(n); 
	return x;
}

function checkBrowser()
{
	//var app = navigator.appName;

	/*Disable Butterfly for Netscape browsers*/
	//if(app != "Microsoft Internet Explorer")
	//{
		
	//}
}


function ExpandLevel(levelID)
{

	if(document.getElementById(levelID).style.display == 'none')
	{
		document.getElementById(levelID).style.display = 'block';
	}
	else
	{
		document.getElementById(levelID).style.display = 'none';
	}
	document.body.style.visibility = "hidden";
	document.body.style.visibility = "visible";
}

function OpenPage(requestID,sCriteria) {
    //alert(requestID);
	if(sCriteria != null)
	{
		//location = '/gateway.aspx?page=' + requestID + '&sCriteria=' + sCriteria;
		location = '/en/' + requestID + '?sCriteria=' + sCriteria;
		return;
	}
    //location = '/gateway.aspx?page=' + requestID;
    location = '/en/' + requestID; 
}

var enlargeWin=0;
function Magnify(image, subtitle, left, top, width, height)
{
  if(enlargeWin)
  {
    if(!enlargeWin.closed) enlargeWin.close();
  }
 
  var URLStr = 'enlargement.asp?image=' + image + '&height=' + height + '&width=' + width + '&subtitle=' + subtitle;
  width += 20;
  height += 129;
  enlargeWin = open(URLStr, 'enlargeWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}

function isValidPhone(phoneStr,phoneType) {
// Checks for the following valid phone formats:
//Regular Expression for whitespace characters
	var phoneEmptyPat = /^\s*$/;
	var matchEmptyArray = phoneStr.match(phoneEmptyPat);
	
	if (matchEmptyArray != null){
		document.getElementById(phoneType).value = '';
		phoneStr = ''; //reset the phone number to an empty string
	}
	
	//Regular Expression for phone string pattern (999)999-9999 
	var phonePat = /^\(\d{3}\)\d{3}-\d{4}/;
	var matchArray = phoneStr.match(phonePat); // is the format ok?

	if (matchArray == null && (phoneStr.length != 0 || phoneStr != '')) {
		//alert('The telephone format has to be (999)999-9999!');
		var alertBox = new EDVAlert(document.getElementById('myAlert'));
		alertBox.addMessage('The telephone format has to be <br/><b>(999)999-9999<b/>!');
		alertBox.size(250,300);
		alertBox.show(400,250);
		} 
	return true;
}

function clearPhoneMask(maskfield){
	if (maskfield.value.substring(0,13) == '(___)___-____') {
		maskfield.value = "";
		}
	}
// Set phone Mask ------------------------------
function setPhoneMask(maskfield){
	maskfield.value = '(___)___-____';
	maskfield.focus();
} 

function checkPhoneOnBlur(maskfield){
	if(maskfield.value == null || maskfield.value == '' || maskfield.value == '(___)___-____'){
		//Reinsert mask as a visual aid for the user
		maskfield.value = "(___)___-____";
	}
	else {
		//validate the entry
		//var validphone = isValidphone(maskfield.value);
		//if (validphone != true) maskfield.focus();
	}
}

// Automatic phoneMask filler to type phone without needing to type "( ) - "
function autoPhoneMask(maskfield,e){
	var vCurrentValue = maskfield.value;
	var vInputKey;
	vInputKey = String.fromCharCode(e.keyCode);
	if (maskfield.value.length == 0){
		if (String.fromCharCode(e.keyCode) != "("){
		//maskfield.value= maskfield.value + "(";
		}
	} else if (maskfield.value.length == 1) {
		if (maskfield.value.substring(0,1) != "("){
		maskfield.value= "(" + maskfield.value;
		}
	} else if (maskfield.value.length == 4) {
		if (String.fromCharCode(e.keyCode) != ")"){
		maskfield.value= maskfield.value + ")";
		}
	} else if (maskfield.value.length == 8) {
		if (String.fromCharCode(e.keyCode) != "-"){
		maskfield.value= maskfield.value + "-";
		}
	} else if (maskfield.value.length == 13) {
		if (String.fromCharCode(e.keyCode) != " "){
		maskfield.value= maskfield.value + " ";
		}
	}
}
function isValidEMail(obj){

	var emailStr = obj.value;
	//Regular Expression for whitespace characters
	var emailEmptyPat = /^\s*$/;
	var matchEmptyArray = emailStr.match(emailEmptyPat);
	
	if (matchEmptyArray != null){
		obj.value = '';
		emailStr = ''; //reset the email address to an empty string
	}

	//Regular Expression for string pattern including the "@" symbol and one "." after 
	var emailPat = /[\w\S]{2,}[@]{1}[\w\S]{2,}[\.]{1}[a-zA-Z]{2,}$/;
	var matchArray = emailStr.match(emailPat);

	if (matchArray == null && (emailStr.length != 0 || emailStr != '')) {
		var alertBox = new EDVAlert(document.getElementById('myAlert'));
		alertBox.addMessage('The Email is not formatted correctly! Expected format: <br/><b>abc@company.com</b>');
		alertBox.size(250,300);
		alertBox.show(400,250);
		return false;
	}
	
	return true;
}

function requiredFields()
{
	var alertText = '';
	var inputElements = document.getElementsByTagName("input");
	for(var ii=0;ii<inputElements.length;++ii)
	{
		if(inputElements[ii].id.substring(0,3) == "req" && (inputElements[ii].value.length == 0 || inputElements[ii].value == '(___)___-____'))
		{
			alertText += '<strong>' + inputElements[ii].name + '</strong> is required!<br/>';
		}
	}
	if(alertText != '')
	{
		//alert(alertText);
		var alertBox = new EDVAlert(document.getElementById('myAlert'));
		alertBox.addMessage(alertText);
		alertBox.size(250,300);
		alertBox.show(580,330);
		return false;
	}
	return true;
}

function submitForm()
{
	if(!requiredFields()) return;
}

function submitAppForm()
{
	if(!requiredFields()) return;
}


//General functions
function EDVAlert(myDiv) {
	
	//Set HTML popup window (DIV)
	this.popup = myDiv;
	
	//Entries (HTML)
	this.messages = "";
	
	//Number of messages
	this.numMessages = 0;

	//Writing the required message box in html
	this.div = '<div style="position: absolute; background-color:#DFF293; top:0; left:0; width:300; height:300; border:1px solid #303A07;">';
	this.header = '<table cellpadding="5" cellspacing="0" border="0" width="100%" style="border:1px solid #303A07; background-color:#DFF293; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#DFF293);"><tr><td><table cellpadding="5" cellspacing="0" border="0" width="100%"><tr><td colspan="2" style="background-color:#303A07;"><font style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; color: #ffffff; text-indent: 4px; text-decoration: none;">Alert:</font><img src="assets/images/transparent.gif" width="10"/></td></tr><tr><td colspan="2" height="5"/></tr><tr><td>';
	this.bodyDiv = '<div style="overflow-y:scroll; border-bottom: 1px solid #303A07; padding:5px; width:100%; height:150; scrollbar-base-color: #DFF293;scrollbar-track-color: #EFEFEF;	scrollbar-face-color: #DFF293;	scrollbar-highlight-color: #EFEFEF;	scrollbar-3dlight-color: #E3E8F9;scrollbar-darkshadow-color: #EFEFEF;scrollbar-shadow-color: #7E8FE2;scrollbar-arrow-color: #ffffff;">';
	this.bodyTable = '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td colspan="2" height="10"/></tr>';
	this.footer = '<tr><td colspan="2" height="20"/></tr></table></div></td></tr><tr><td colspan="2" align="center"><font style="font-family: Arial, Helvetica, sans-serif;	font-size: 9px; font-weight: normal; color: #303A07;	text-decoration:none;">To close this window, click on the link below!</font></td></tr><tr><td colspan="2" height="10"/></tr>';
	this.footerClose = '<tr><td colspan="2" align="center"><a id="AlertHide" href="javascript:void();" tabindex="1" onclick="document.getElementById(\'' + this.popup.id + '\').style.visibility = \'hidden\';"><font style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: normal; color: #303A07;	text-decoration: underline;">Close</font></a></td></tr></table></td></tr></table></div>';

	// ---------------------------------------------------------------------------------------------------
	// addMessage(): Adds an error entry to the SOARPopup Error Messagebox
	//
	// pErrorText: Error Text (can be HTML)
	// ---------------------------------------------------------------------------------------------------
	this.addMessage = function(pErrorText) {
		this.messages += '<tr><td colspan="2"><font style="font-family: Arial, Helvetica, sans-serif; '
			+ 'font-size: 14px; font-weight: normal; color: #303A07;text-decoration: none;">'
			+ '<font style="color:#303A07">'
			+ pErrorText
			+ '</font></font></td></tr>';
		this.numMessages += 1;
	}

	// ---------------------------------------------------------------------------------------------------
	// addConditionalMessage():	Adds an error entry to the Alert Error Messagebox, IF pCondition is true
	//							and set the style attribute of the flag to visible
	//
	// pCondition: Condition which is checked
	// pErrorText: Error Text (can be HTML)
	// pFlag: Flag item is set to visible if condition is true (optional!)
	// ---------------------------------------------------------------------------------------------------
	this.addConditionalMessage = function(pCondition,pErrorText,pFlagID) {
		if(pCondition)
		{
			if(pFlagID!=null) document.getElementById(pFlagID).style.visibility = 'visible';
			this.addMessage(pErrorText);
		}
		else
		{
			if(pFlagID!=null) document.getElementById(pFlagID).style.visibility = 'hidden';
		}
	}	

	// ---------------------------------------------------------------------------------------------------
	// size(): resizes the alert box
	// ---------------------------------------------------------------------------------------------------
	//	default height and width
	var vHeight = 300;
	var vWidth = 250;
	this.size = function(w,h)
	{
		if(w != null) vWidth = w;
		if(h != null) vHeight = h;
	}
	
	// ---------------------------------------------------------------------------------------------------
	// show(): shows the message box
	// x: X-Coordinate of popup window (default centered = 300)
	// y: Y-Coordinate of popup window (default centered = 300)
	// ---------------------------------------------------------------------------------------------------
	
	this.show = function(x,y) {
		
		htmlString = this.header + this.bodyDiv + this.bodyTable + this.messages + this.footer
			+ this.footerClose;
		
		if (x == null)x = 300;
		if (y == null)y = 300;
		
		this.popup.innerHTML = htmlString; 
		this.popup.style.left = x;
		this.popup.style.top = y;
		this.popup.style.width = vWidth;
		this.popup.style.height = vHeight;
		this.popup.style.visibility = 'visible';
	}
	
}


var openShow = 0;
function openShowroom(src,h,w)
{
	if(openShow)
	{
		if(!openShow.closed) 
		{
			openShow.close();
		}
	}
	openShow = window.open(src,'openShow','menubar=0,scrollbars=1,toolbar=0,locationbar=0,resizable=1,personalbar=0,statusbar=0,width='+ w +',height=' + h + ',left=50,top=50')
	//openShow.focus();
}
var openStyle = 0;
function openStyles(src,h,w)
{
	if(openStyle)
	{
		if(!openStyle.closed) 
		{
			openStyle.close();
		}
	}
	openStyle = window.open(src,'openStyle','menubar=0,scrollbars=1,toolbar=0,locationbar=0,resizable=0,personalbar=0,statusbar=0,width='+ w +',height=' + h + ',left=50,top=50')
	//openStyle.focus();
}

var openWin = 0;
function openURL(url,w,h,x,y)
{
	openWin = window.open(url,'openWin','menubar=0,scrollbars=1,toolbar=0,locationbar=0,resizable=1,personalbar=0,statusbar=0,width='+ w +',height=' + h + ',left=0,top=0')
	openWin.focus();
	
	//Set position
    //openWin.moveTo(x,y); --Access denied under IE security considerations
        
}

function openWindow()
{
	var url,w,h,x,y,args = openWindow.arguments;
	if(args.length == 0) return;
	url = args[0];
	
	if(args.length > 1) 
	{
		w = args[1];
		h = args[2];
	}
	else
	{
		//set width and height
		//window.moveTo(0,0) --Access denied under IE security considerations
		if (document.all){
  			h = screen.availHeight-50;
  			w = screen.availWidth-50;
		}
		else if (document.layers||document.getElementById){
  			if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
    			h = window.outerHeight-20;
    			w = window.outerWidth-20;
  			}
		}
	}
	if(args.length > 3)
	{
	    x = args[3];
	    y = args[4];
	}
	else
	{
	    x = 0;
	    y = 0;
	}
	
	openURL(url,w,h,x,y);
}

function SetInActive()
{
	var sID = null;
	var bSelected = false;
	var colInput = document.all.tags('Input');
	for(var i = 0; i < colInput.length; i++)
	{
		if(colInput[i].id.substring(0,6) == 'ItemID' && colInput[i].checked)
		{
			sID = colInput[i].id.substring(6,colInput[i].id.length);
			bSelected = true;
		}
	}
	
	if(bSelected)
	{
		var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
		xmlDoc.async = false;
		xmlDoc.loadXML('<Request><RequestID>Inactive</RequestID><ID>'+ sID +'</ID></Request>');
		
		SaveXML(xmlDoc);
	}
	else
	{
		alert('Select an item before \nperforming this action!');
	}
}

function DeleteItem()
{
	var sID = null;
	var bSelected = false;
	var colInput = document.all.tags('Input');
	for(var i = 0; i < colInput.length; i++)
	{
		if(colInput[i].id.substring(0,6) == 'ItemID' && colInput[i].checked)
		{
			sID = colInput[i].id.substring(6,colInput[i].id.length);
			bSelected = true;
		}
	}
	
	if(bSelected)
	{
		var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
		xmlDoc.async = false;
		xmlDoc.loadXML('<Request><RequestID>Delete</RequestID><ID>'+ sID +'</ID></Request>');
		
		SaveXML(xmlDoc);
	}
	else
	{
		alert('Select an item before \nperforming this action!');
	}
}

function SetPriority()
{
	var sID = null;
	var bSelected = false;
	var colInput = document.all.tags('Input');
	for(var i = 0; i < colInput.length; i++)
	{
		if(colInput[i].id.substring(0,6) == 'ItemID' && colInput[i].checked)
		{
			sID = colInput[i].id.substring(6,colInput[i].id.length);
			bSelected = true;
		}
	}
	
	if(bSelected)
	{
		var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
		xmlDoc.async = false;
		xmlDoc.loadXML('<Request><RequestID>Priority</RequestID><Priority>'+ document.getElementById('Priority').value +'</Priority><ID>'+ sID +'</ID></Request>');
	
		SaveXML(xmlDoc);
	}
	else
	{
		alert('Select an item before \nperforming this action!');
	}

}
function HTMLDecode(s)
{
	return HTMLDecoding(s);
}
function HTMLDecoding(s){
	s = s.replace(new RegExp(/&lt;/gi), "<");
	s = s.replace(new RegExp(/&gt;/gi), ">");
	s = s.replace(new RegExp(/&amp;/gi), "&");
	return s;
}

function SaveXML(CommandContext){
	//Send client CommandContext
	//alert(CommandContext.xml); return;
	
	var xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	xmlHTTP.open("POST","adminsave.asp", false);
	xmlHTTP.send(CommandContext);
	

	//Transform on the client
		var vResponseContext = xmlHTTP.ResponseText;
		var newDocument = document.open("text/html","replace");
		newDocument.write(vResponseContext);
		newDocument.close();
}

//The following function is for elements called "Hidden"
function HiddenDisplay(id)
{
	if(document.getElementById(id).style.display == 'block')
	{
		document.getElementById(id).style.display = 'none';
		document.getElementById('Handle'+id).src = 'assets/images/hidden_down.gif';
	}
	else
	{
		//Close all other link windows (hidden displays) first
		
		var divElements = document.getElementsByTagName("div");
		for(var i = 0; i < divElements.length; i++)
		{
			if(divElements[i].id.substring(0,10) == "LinkWindow")
			{
				divElements[i].style.display = 'none';
				document.getElementById('Handle'+divElements[i].id).src = 'assets/images/hidden_down.gif';
			}
		}
		
		document.getElementById(id).style.display = 'block';
		document.getElementById('Handle'+id).src = 'assets/images/hidden_up.gif';
	}
}

function XMLobj()
{
		//Multi Browser Support
		var xmlobj =false;

		// JScript gives us Conditional compilation, we can cope with old IE versions.
		// and security blocked creation of the objects.
		try 
		{
			//Newer IE
			xmlobj = new ActiveXObject("Msxml2.DOMDocument");
		} 
		catch (e) 
		{
			try 
			{
				//Older IE
				xmlobj = new ActiveXObject("Microsoft.DOMDocument");
			} 
			catch (ee) 
			{
				xmlobj = false;
			}
		}
		//Other Browsers
	
		if (!xmlobj) 
		{
			var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');
			if(moz)
			{
				xmlobj = document.implementation.createDocument("", "doc", null);
			}
			else
				xmlobj = null;
		}

		
		return xmlobj;
}

function XMLHttpObj()
{
	//Multi Browser Support
		var xmlhttp=false;

		// JScript gives us Conditional compilation, we can cope with old IE versions.
		// and security blocked creation of the objects.
		try 
		{
			//Newer IE
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try 
			{
				//Older IE
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (ee) 
			{
				xmlhttp = false;
			}
		}
		//Other Browsers
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
			xmlhttp = new XMLHttpRequest();
		}
		
		return xmlhttp;
}

function PrintPage()
{
	window.print();
}


function DateToday(){
	var iDate = new Date();
	var iMonth;
	var iDay;
	var iYear;
	iMonth = iDate.getMonth() + 1; 
	if (iMonth <= 9){iMonth = '0' + iMonth};
	iDay = iDate.getDate() + 1;
	if (iDay <= 9){iDay = '0' + iDay};
	iYear = iDate.getFullYear();
	iToday = iMonth + '/' + iDay + '/' + iYear;
	return iToday;
}


function userLogin(pageID)
{
    //Check whether username and password are entered
    var username = document.getElementById('un').value;
    var password = document.getElementById('pw').value;
    
    location = 'gateway.aspx?page=' + pageID + '&U=' + username + '&P=' + password; 
}


//Multi Browser Support
var xmlhttp;
function edvMail()
{
	
	//Email Properties (defaults)
	var eTo = "info@edv-design.com";
	var eFrom = "";
	var eCC = "";
	var eBCC = "";
	var eBody = "";
	var eBodyFormat = "text";
	var eSubject = "";
	var eResponse = "";
	var url;
	
	this.To = function(sTo){eTo = sTo;}
	this.From = function(sFrom){eFrom = sFrom;}
	this.CC = function(sCC){eCC = sCC;}
	this.BCC = function(sBCC){eBCC = sBCC;}
	this.Body = function(sBody){eBody = sBody;}
	this.BodyFormat = function(sBodyFormat){eBodyFormat = sBodyFormat;}
	this.Subject = function(sSubject){eSubject = sSubject;}
	this.Response = function(){return eResponse;}
	this.URL = function(){return url;}
	
    
	this.Mail = function(sUrl)
	{
	    
		//Create url for email
		url = 'To=' + eTo;
		url += '&From=' + eFrom ;
		url += '&CC=' + eCC;
		url += '&BCC=' + eBCC;
		url += '&Subject=' + eSubject;
		url += '&Body=' + eBody;
		url += '&BodyFormat=' + eBodyFormat;
		
		
		
		//var win = openURL("http://www.edv-design.com/edvmail.asp?" + url,'200','30','300','300');
		var win = openURL("http://www.litholink.com/mail.aspx?" + url,'200','30','300','300');
		//win.close();
		//Write Respons
		
		win.opener.document.location = sUrl;
		
		
        eResponse = "Your Information was submitted successfully!";
	}
}



function MailPhysicianSignUp()
{
    //Retrieve Form Elements
    var lastName, firstName, title, practice, street1, street2, city,state,zip,phone,contact,upin,email,note;
    lastName = document.getElementById('LastName').value;
    firstName = document.getElementById('FirstName').value;
    title = document.getElementById('JobTitle').value;
    practice = document.getElementById('Practice').value;
    street1 = document.getElementById('Street1').value;
    street2 = document.getElementById('Street2').value;
    city = document.getElementById('City').value;
    state = document.getElementById('State').value;
    zip = document.getElementById('Zip').value;
    phone = document.getElementById('Telephone').value;
    contact = document.getElementById('Contact').value;
    upin = document.getElementById('UPIN').value;
    email = document.getElementById('EMail').value;
    note = document.getElementById('Note').value;
    
    
    
	
	var body = '<html><head/><body><p>The following request for physician sign-up came from our website:</p>';
	body += '<table border="1" cellspacing="0" cellpadding="1" style="border:1px solid black">';
	body += '<tr><td width="150" style="color:white;background-color:black;">First Name</td><td>' + firstName + '</td></tr>';
	body += '<tr><td style="color:white;background-color:black;">Last Name</td><td>' + lastName + '</td></tr>';
	body += '<tr><td style="color:white;background-color:black;">Title</td><td>' + title + '</td></tr>';
	body += '<tr><td style="color:white;background-color:black;">Practice Name</td><td>' + practice + '</td></tr>';
	body += '<tr><td style="color:white;background-color:black;">Street 1</td><td>' + street1 + '</td></tr>';
	body += '<tr><td style="color:white;background-color:black;">Street 2</td><td>' + street2 + '</td></tr>';
	body += '<tr><td style="color:white;background-color:black;">City</td><td>' + city + '</td></tr>';
	body += '<tr><td style="color:white;background-color:black;">State</td><td>' + state + '</td></tr>';
	body += '<tr><td style="color:white;background-color:black;">Zip Code</td><td>' + zip + '</td></tr>';
	body += '<tr><td style="color:white;background-color:black;">Telephone</td><td>' + phone + '</td></tr>';
	body += '<tr><td style="color:white;background-color:black;">Contact Name</td><td>' + contact + '</td></tr>';
	body += '<tr><td style="color:white;background-color:black;">UPIN</td><td>' + upin + '</td></tr>';
	body += '<tr><td style="color:white;background-color:black;">EMail</td><td>' + email + '</td></tr>';
	body += '<tr><td style="color:white;background-color:black;">Note</td><td>' + HTMLDecode(note) + '</td></tr>';
	body += '</table></body></html>';
	
	//Clean Content
	document.getElementById('LastName').value = "";
    document.getElementById('FirstName').value = "";
    document.getElementById('JobTitle').value = "";
    document.getElementById('Practice').value = "";
    document.getElementById('Street1').value = "";
    document.getElementById('Street2').value = "";
    document.getElementById('City').value = "";
    document.getElementById('State').value = "";
    document.getElementById('Zip').value = "";
    document.getElementById('Telephone').value = "";
    document.getElementById('Contact').value = "";
    document.getElementById('UPIN').value = "";
    document.getElementById('EMail').value = "";
    document.getElementById('Note').value = "";
    
    
    
    var mailObj = new edvMail();
	mailObj.To("PhysicianSignUp@litholink.com");
	//mailObj.To("cpersinger@litholink.com");
	mailObj.From("info@litholink.com");
	mailObj.Subject("Physician Sign-Up Request");
	mailObj.BodyFormat("html");
	mailObj.Body(body);
	mailObj.Mail('gateway.aspx?page=signupsuccess');

}

function HTMLDecode(s)
{
	return HTMLDecoding(s);
}
function HTMLDecoding(s){
	s = s.replace(new RegExp(/&lt;/gi), "<");
	s = s.replace(new RegExp(/&gt;/gi), ">");
	s = s.replace(new RegExp(/&amp;/gi), "&");
	return s;
}

function SubmitOnlineOrder()
{
    //Check required fields
    var ptLastName = IsEntered('PtLastName');
    var ptFirstName = IsEntered('PtFirstName');
    var physician = IsEntered('Physician');
    var ptDOB = IsEntered('PtDOB');
    var ptPhoneNumber = IsEntered('PtPhoneNumber');
    
    if(ptLastName && ptFirstName && physician && ptDOB && ptPhoneNumber)
    {
        document.getElementById('OrderFollowUpForm').submit();
    }
    else
        alert('Please enter all required fields!');
}

function IsEntered(field)
{
    var obj = document.getElementById(field);
    if(obj.value.length > 0)
    {
        obj.style.borderColor = '';
        return true;
    }
    else
    {
        obj.style.borderColor = 'red';
        return false;
    }
}
