﻿// JScript File

// JScript File
function calendarPicker(txtDate)
{
    //generic function to display Date picker calendar
    //Note: caller must supply the control and window is placed in center of screen
    var strOptions = "";
    
    //set options for window
    strOptions = "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,left=" + ((screen.width - 350) / 2) + ",top=" + ((screen.height - 250) / 2) + ",width=350,height=250";
    
    //open the window
    window.open('DatePicker.aspx?field=' + txtDate, 'calendarPopup', strOptions);
}

function stringReplace(strInString, strFindString, strReplaceString)
{	
	//replace text in string, handles many occurrances
	var strPre = "";
	var strPost = "";
	var lngPos = 0;
	var lngLen = strFindString.length;
	
	//find string
	lngPos = strInString.indexOf(strFindString);
	
	while (lngPos != -1)
	{
		strPre = strInString.substring(0, lngPos);
		strPost = strInString.substring(lngPos + lngLen, strInString.length);
		
		//now combine and replace string
		strInString = strPre + strReplaceString + strPost;
		
		//find next occurrance
		lngPos = strInString.indexOf(strFindString);
	}
	
	//return new string
	return strInString;
}

function open_window (strURL, strOptions)
{
	newWindow = window.open(strURL, "popupwin", strOptions);
	newWindow.focus();
}

function open_window_Language(strID, strTable, strType)
{
	//open Language Window
	var strOptions = "";
	var strURL = "";
	
	//build URL, passing all necessary data
	strURL = "LanguageDetail.aspx?ID=" + strID + "&Table=" + escape(strTable) + "&Type=" + escape(strType)
	
	//build options
	strOptions = "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,left=" + ((screen.width - 650) / 2) + ",top=" + ((screen.height - 450) / 2) + ",width=650,height=450"
	
	//open the new window
	window.open(strURL, "winLanguage", strOptions);
}