﻿// JScript File
function mNavigateOrlando()
{
  window.open('http://www.udsmr.org/Orlando/default.htm', 'Orlando', 'height=550,width=600');
}

function mNavigateLasVegas()
{
  window.open('http://www.udsmr.org/LasVegas/default.htm', 'LasVegas', 'height=550,width=600');
}

function mfpOpenPopupWindow(pStrTitle, pIntHeight, pIntWidth, pBlnShowScrollbar, pStrDestination)
{
  /*
 	Parameters
	 pStrTitle			= Title of the modal screen
	 pIntHeight			= Height
	 pIntWidth			= Width
	 pBlnShowScrollbar	= If you wish to show the scrollbar in the modal form.
	 pStrDestination	= Destination with complete querystring etc..
	*/
	
	var pOutput;
	var strOptions = '';
	var pIEVersion;
	var dialogWin = new Object();


	//Get the unique dialog name; so as to avoid overwriting existing dialog box.
	var strDlgName = (new Date()).getSeconds().toString();
	
	pIEVersion = '';

	pIEVersion = navigator.appVersion;

	dialogWin.width = pIntWidth;
	dialogWin.height = pIntHeight;
	
	if(navigator.appName == 'Netscape')
	{
			pBlnShowScrollbar = 1;
	}
	if (pBlnShowScrollbar == 1)
		pStrShowScrollbar ="Yes";
	else
		pStrShowScrollbar ="No";

	pStrURL = pStrDestination;

	//Check for the browser type.
	if(navigator.appName == 'Netscape')
	{
		//Center form in Netscape
		dialogWin.left = window.screenX + ((window.outerWidth - dialogWin.width)/2);
		dialogWin.top = window.screenY + ((window.outerHeight - dialogWin.height)/2);
		strOptions = strOptions + ' height=' + pIntHeight;
		strOptions = strOptions + ',width=' + pIntWidth;
		//To Handle Error Check Print in Netcape 7. onwards....
		pStrDestination = pStrDestination.toUpperCase();
		var pVersion = navigator.userAgent
		pStrDestination = pStrDestination.indexOf('PAIERRORCHECK.ASPX')
		pVersion = pVersion.indexOf('Netscape6')
		if ((pStrDestination >= 0) && (pVersion == -1))
		{
			strOptions = strOptions + ',modal=' + 'no';
		}
		else
		{
			strOptions = strOptions + ',modal=' + 'yes';
		}
		strOptions = strOptions + ',screenX=' + dialogWin.left;
		strOptions = strOptions + ',screenY=' + dialogWin.top;
		strOptions = strOptions + ',';

		dialogWin.returnedValue = '';
		dialogWin.win=window.open(pStrURL, strDlgName, strOptions);
		pOutput = dialogWin.returnedValue;
	}
	else
	{
		
		//HYD1205123 11/02/2006 Added this because we need to reduce the page size to 50
		//when user opens application from I.E 7
		if (pIEVersion.indexOf("MSIE 7.0;") > -1)
		{
			dialogWin.height = dialogWin.height - 50;
			pIntHeight = dialogWin.height;
		}
		//End HYD1205123 11/02/2006
		
		//Center form in IE
		dialogWin.left = (screen.width - dialogWin.width)/2;
		dialogWin.top = (screen.height - dialogWin.height)/2;

		strOptions = strOptions + 'dialogHeight: ' + pIntHeight + 'px;';
		strOptions = strOptions + 'dialogWidth: ' + pIntWidth +'px';
		strOptions = strOptions + 'center: no; ';
		strOptions = strOptions + 'help: No; ';
		strOptions = strOptions + 'resizable: No; ';
		strOptions = strOptions + 'status: No; ';
		strOptions = strOptions + 'left:' + dialogWin.left + '; ';
		strOptions = strOptions + 'top:' + dialogWin.top + '; ';
		pOutput = window.showModalDialog(pStrURL, strDlgName, strOptions);
	  //window.showModalDialog(pStrURL, strDlgName, strOptions);
	}

	return true;

}

function mfpDownloadExportFile(aFilePath)
{						
  var pPageName;
	pPageName = 'ShowDownLoad.aspx?pFileName=' + aFilePath;
	mfpOpenPopupWindow('Download', 200, 385, 0, pPageName);									
	return true;	

}

function mfpValidateForm(aStrFirst, aStrMiddle, aStrLast)
{
  var blnCheck
  alert('inside');
 blnCheck = mCheckSpecialChar(aStrFirst);
 if(blnCheck)
 {
  alert('no specail char');
 }
 else
 {
  alert('yes');
 }

}

//===============================================================================
//	Function Name	:	mCheckSpecialChar
//	Purpose			:	Checking for all special characters
//						This function "mCheckSpecialChar" has two arguements.
//						First arguement is control need to be validated
//						Second arguement is list of special charecters need to be validated
//						(This is optional, if you omit while calling then the system will consider all special charecters).

//						It will return true - If Success otherwise False.

function mCheckSpecialChar(astrObj,aStrSpecialChars)
{
		var pStrValue; //used to store the control value
		pStrValue = astrObj //mTrim(aObjName.value);
		if ((aStrSpecialChars == undefined) || (aStrSpecialChars == ""))
		{
			aStrSpecialChars = "\\-</?*^%$>#&;:,\()'\"!`~<>=@|%_+{}[]|";
		}
		if (pStrValue!='')
		{
			var pStrInnerValue; //used to store the control value for validations
			var pLngInnerCount;//used for counter
			var pLngCount;//used for counter
			var pIntVal=false;///used for flag
			pStrInnerValue=pStrValue;
			for(pLngCount=0;pLngCount<pStrInnerValue.length;pLngCount++)
			{
				for(pLngInnerCount=0;pLngInnerCount<aStrSpecialChars.length;pLngInnerCount++)
				{
					if (pStrInnerValue.charAt(pLngCount)==aStrSpecialChars.charAt(pLngInnerCount))
					{
						pIntVal=true;
					}
				}
			}
			if (pIntVal==true)
			{
				return false;
			}
		}
		return true;
}
