
var winHandle; 
var strChkBoxReportType;


function CheckSQLInjection(obj,args) 
{
  var re = new RegExp("(select)|(update)|(insert)|(delete)|(grant)|(revoke)|(union)","i");
  if (args.Value.match(re)) {
    args.IsValid = false;
  } else {
    args.IsValid = true;
  }
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

/* 
	onclick="MM_showHideLayers('mydiv','','hide')"
	onchange="MM_showHideLayers('mydiv','','show')"
	
*/
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_setTextOfTextfield(objName, newText) { //v3.0
  var obj = MM_findObj(objName); if (obj) obj.value = newText;
}




/*
onLoad="MM_changeProp('leftcol','','style.marginLeft','-127','DIV')"
*/
function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

function GetLookUpValue(controlId)
{
	var value;
	if (document.getElementById(controlId + "_DropDownList")!=null)
	{
		value = document.getElementById(controlId + "_DropDownList").value;
	}
	else if (document.getElementById(controlId + "_ReturnInput")!=null)
	{
		value = document.getElementById(controlId + "_ReturnInput").value;	
	}
	
	if (value=="")
		value = "-1";
	
	return value;
}



function GetLookUpSelectedCount (controlId)
{
	var intSelectedID = 0;
	var control = MM_findObj(controlId);

	if (control.tagName.toLowerCase() == "select")
	{
		for (var i = 0; i < control.options.length; i++ )
		{
			if(control.options[i].selected == true)
			{
				intSelectedID ++;
			}
		}
	}
	else if (MM_findObj(controlId + "_ListBox") != null)
	{
		var lookup = MM_findObj(controlId + "_ListBox");
		for (var i = 0; i < lookup.options.length; i++)
		{
			if(lookup.options[i].selected == true)
			{
				intSelectedID ++;
			}
		}
	}
	
	return intSelectedID;
}

function GetLookUpSelectedCountExcludeFirstItem (controlId)
{
	var intSelectedID = 0;
	var control = MM_findObj(controlId);

	if (control.tagName.toLowerCase() == "select")
	{
		for (var i = 1; i < control.options.length; i++ )
		{
			if(control.options[i].selected == true)
			{
				intSelectedID ++;
			}
		}
	}
	else if (MM_findObj(controlId + "_ListBox") != null)
	{
		var lookup = MM_findObj(controlId + "_ListBox");
		for (var i = 1; i < lookup.options.length; i++)
		{
			if(lookup.options[i].selected == true)
			{
				intSelectedID ++;
			}
		}
	}
	
	return intSelectedID;
}

function ValidateListBoxSelection(controlId)
{
	var selectAll = false;
	var validate = true;
	var control = MM_findObj(controlId);

	if (control.tagName.toLowerCase() == "select")
	{
		for (var i = 0; i < control.options.length; i++ )
		{
			if(control.options[i].selected == true)
			{
				if (selectAll)
				{
					validate = false;
					break;
				}				
				// first item (all selections)
				if (i == 0)
					selectAll = true;
			}
		}
	}
	else if (MM_findObj(controlId + "_ListBox") != null)
	{
		var lookup = MM_findObj(controlId + "_ListBox");
		for (var i = 0; i < lookup.options.length; i++)
		{
			if(lookup.options[i].selected == true)
			{
				if (selectAll)
				{
					validate = false;
					break;
				}				
				// first item (all selections)
				if (i == 0)
					selectAll = true;
			}
		}
	}
	return validate;
}

function ValidateListBoxSelectionExcludeFirstItem(controlId)
{
	var selectAll = false;
	var validate = true;
	var control = MM_findObj(controlId);

	if (control.tagName.toLowerCase() == "select")
	{
		for (var i = 1; i < control.options.length; i++ )
		{
			if(control.options[i].selected == true)
			{
				if (selectAll)
				{
					validate = false;
					break;
				}				
				// first item (all selections)
				if (i == 0)
					selectAll = true;
			}
		}
	}
	else if (MM_findObj(controlId + "_ListBox") != null)
	{
		var lookup = MM_findObj(controlId + "_ListBox");
		for (var i = 1; i < lookup.options.length; i++)
		{
			if(lookup.options[i].selected == true)
			{
				if (selectAll)
				{
					validate = false;
					break;
				}				
				// first item (all selections)
				if (i == 0)
					selectAll = true;
			}
		}
	}
	return validate;
}

function ValidatePDFPrintCountNew(type, gridId, isAdvancedSearch)
{
	var totalRecord = MM_findObj(gridId + "_dgTotalRecord").value;
	var recordPerPage = 20;
	
	if (type=="pdf")
	{
		if (MM_findObj(gridId + "_dgRecordPerPrintPage")!=null)
			recordPerPage = MM_findObj(gridId + "_dgRecordPerPrintPage").value;
			
		//if (parseInt(totalRecord)>parseInt(recordPerPage)*250)
		var recordLimit =  20 * 3000 ; 
		var totalRecordLimit = parseInt(totalRecord); 
		if (totalRecordLimit > recordLimit)
		{
		    closePopUp('Close',1) ;
		    if (!isAdvancedSearch)
			    alert('This report will result in more than 250 pages. Reports exceeding 250 pages cannot be generated. Please use the filtering options to filter the data.');
		    else
		        alert('This report will result in more than 250 pages. Reports exceeding 250 pages cannot be generated. \n\nPlease save this search and schedule it to be generate overnight as a batch process.');
			return false; 
		}
		
		if (parseInt(totalRecord)>parseInt(recordPerPage)*100)
		{
		    closePopUp('Close',1) ;
			return window.confirm('It is estimated that your report will exceed 100 pages.  It will take a while before the report can be returned to you. Please be patient while the report is created. If the report gives a time out error, you should use the filtering options to filter the data.\r'+
			'Click <OK> to proceed or <Cancel> to cancel the request');
		}
	}
	else if (type=="excel")
	{
		if (parseInt(totalRecord)>10000)
		{
		    closePopUp('Close',1) ;
		    if (!isAdvancedSearch)
    		    alert("This report will result in more than 10,000 rows. Reports exceeding 10,000 rows cannot be generated. Please use the filtering options to filter the data.");
		    else
	            alert('This report will result in more than 10,000 rows. Reports exceeding 10,000 rows cannot be generated. \n\nPlease save this search and schedule it to be generate overnight as a batch process.');

			return false;
		}
	}
	
	return true;
}

function ValidatePDFPrintCount(type)
{
	var totalRecord = MM_findObj("__dgTotalRecord").value;
	var recordPerPage = 20;
	
	if (type=="pdf")
	{
		if (MM_findObj("__dgRecordPerPrintPage")!=null)
			recordPerPage = MM_findObj("__dgRecordPerPrintPage").value;
			
		if (parseInt(totalRecord)>parseInt(recordPerPage)*250)
		{
		    closePopUp('Close',1) ;
			alert('This report will result in more than 250 pages. Reports exceeding 250 pages cannot be generated. Please use the filtering options to filter the data.');
			return false; 
		}
		
		if (parseInt(totalRecord)>parseInt(recordPerPage)*100)
		{
		    closePopUp('Close',1) ;
			return window.confirm('It is estimated that your report will exceed 100 pages.  It will take a while before the report can be returned to you. Please be patient while the report is created. If the report gives a time out error, you should use the filtering options to filter the data.\r'+
			'Click <OK> to proceed or <Cancel> to cancel the request');
		}
	}
	else if (type=="excel")
	{
		if (parseInt(totalRecord)>10000)
		{
		    closePopUp('Close',1) ;
			alert("This report will result in more than 10,000 rows. Reports exceeding 10,000 rows cannot be generated. Please use the filtering options to filter the data.");
			return false;
		}
	}
	
	return true;
}


function redirectToSystemTemplates()
{
    if(window.confirm('You will be logoff from DudeBITS and redirect to PMDGlobal. \rIf you need to go come back to DudeBITS, you will need to logon again.\r'+
			'Click <OK> to proceed or <Cancel> to cancel the request'))
    {
        window.location.href = "LoginSystemTemplates.aspx";
    }
}


function showmessage(message,title,buttonType,basePath)
{
     try
     {
         var features = "dialogHeight:300px;dialogWidth:400px;scroll:no;help:no;status:no;dialogHide:true";
         if(basePath == null)
         basePath = "../";
         return showModalDialog (basePath + "Alert.aspx?title=" + title + "&buttonType=" + buttonType,message,features);
     }
     catch(e)
     {
        return -1;
     }
}


function showmessagePopUp(message,title,buttonType,basePath)
{
	try
	{
		var features = "dialogHeight:300px;dialogWidth:400px;scroll:no;help:no;status:no;dialogHide:true";	
		if(basePath == null)
			basePath = "../";
		var strURL = basePath + "Alert.aspx?title=" + title + "&buttonType=" + buttonType + "&message=" + message;
		AlertPopUp(strURL);
		//return showModalDialog (basePath + "Alert.aspx?title=" + title + "&buttonType=" + buttonType,message,features); 
	}
	catch(e)
	{
		return -1;
	}
}

function showwindowpopup(url,width,height)
{
	try
	{
		var features = "dialogHeight:" + width + ";dialogWidth:" + height + ";help:no;scroll:no;status:no;dialogHide:true";	
		return showModalDialog (url,window,features); 
	}
	catch(e)
	{
		return -1;
	}
}



/* ------ show modal for all browsers -------- */
var winModalWindow
 
function showpopup(url,width,height)
{
//	if (window.showModalDialog)
//	{
//		showwindowpopup (url,width,height);
//	}
//	else
//	{
        var winModalWindow;
        if (window.showModalDialog)
		    winModalWindow = window.open (url,"SchoolDude","dependent=yes,status=yes, menubar=yes, scrollbars=no,resizable=yes,width=" + width + ",height=" + height,"false");
		else
		    winModalWindow = window.open (url,"SchoolDude","dependent=yes,status=yes, menubar=yes, scrollbars=yes,resizable=yes,width=" + width + ",height=" + height,"false");
		
		winModalWindow.focus();
//	}
}

function showpopup2(url,width,height)
{
//	if (window.showModalDialog)
//	{
//		showwindowpopup (url,width,height);
//	}
//	else
//	{
        var winModalWindow;
        if (window.showModalDialog)
		    winModalWindow = window.open (url,"SchoolDude2","dependent=yes,status=yes, menubar=yes, scrollbars=no,resizable=yes,width=" + width + ",height=" + height,"false");
		else
		    winModalWindow = window.open (url,"SchoolDude2","dependent=yes,status=yes, menubar=yes, scrollbars=yes,resizable=yes,width=" + width + ",height=" + height,"false");
		
		winModalWindow.focus();
//	}
}

function showpopupsample(url,width,height)
{
	winModalWindow = window.open (url,"SchoolDude","dependent=yes,status=yes, menubar=yes, scrollbars=yes,resizable=yes,width=" + width + ",height=" + height,"false");
	winModalWindow.focus();
}
 
function ShowModalWindow(message,title,buttonType,basePath)
{
	
  if (window.showModalDialog)
  {
    //For IE
	showmessage(message,title,buttonType,basePath);
  }
  else
  {
    //For Netscape
    window.top.captureEvents (Event.CLICK|Event.FOCUS);
    window.top.onclick=IgnoreEvents;
    window.top.onfocus=HandleFocus ; 
    //Escape the message vi 52583
    MM_findObj("ValidationMessage").value =  escape(message);
    //winModalWindow = window.open (basePath + "Alert.aspx?title=" + title + "&buttonType=" + buttonType,"ModalChild","dependent=yes,width=400,height=300","false");
    winModalWindow = window.open (basePath + "Alert.aspx?title=" + title + "&buttonType=" + buttonType,"SchoolDude","dependent=yes,width=400,height=300","false");
    winModalWindow.focus();

  }
}

function IgnoreEvents(e)
{
  return false;
}
 
function HandleFocus()
{
  if (winModalWindow)
  {
    if (!winModalWindow.closed)
    {
      winModalWindow.focus();
    }
    else
    {
      window.top.releaseEvents (Event.CLICK|Event.FOCUS);
      window.top.onclick = "";
    }
  }
  return false;
}

/* This method is used to get Message Hidden variable */
function getMessage(messageId)
{

	if(MM_findObj(messageId.toLowerCase())!=null)
	{
		return 	MM_findObj(messageId.toLowerCase()).value;
	}	
	else if(MM_findObj(messageId.toUpperCase())!=null)	
	{
		return 	MM_findObj(messageId.toUpperCase()).value;
	}
	else if(MM_findObj(messageId)!=null)	
	{
	    return 	MM_findObj(messageId).value;
	}
	else
	{
		return "Error while getting client message. Message not found. Contact administrator";
	}		
}

function IsPageValid()
{
	if (MM_findObj("__pagemode").value == "update")
		return true;
	else
		return false;
}

function GetHour(hour)
{
	var hourString = "";
	if (hour>12)
	{
		hour = hour-12;
		hourString = hour.toString();
	}
	else
	{
		if (hour==0)
			hourString = "12";
		else
			hourString = hour.toString();
	}

	return hourString;
}

function GetAMPM(hour)
{
	if (hour>=12)
		return "PM";
	else
		return "AM";
}

/* dean's bdp date functions for onClientAfterSelectionChanged event*/
function dateDiffH(dt1, dt2)
{
	var iOneHour = 1000*60*60;
	return Math.ceil((dt2.getTime()-dt1.getTime())/(iOneHour));
}

function dateDiffD(dt1, dt2)
{
	var iOneDay = 1000*60*60*24;
	return Math.ceil((dt2.getTime()-dt1.getTime())/(iOneDay));
}

function dateDiffS(sFrom, sTo)
{
	return dateDiffD(new Date(sFrom), new Date(sTo));
}

	
function dateIsValid(sDate, sMsg)
{
	if(!sMsg) sMsg = "Invalid Date Value Entered.";
	
	var rexMMDDYYYY = /(0*[1-9]|1[012])[- \/.](0*[1-9]|[12][0-9]|3[01])[- \/.](19|20)\d\d/;
//	var rexDDMMYYYY = /(0*[1-9]|[12][0-9]|3[01])[- \/.](0*[1-9]|1[012])[- \/.](19|20)\d\d/;
//	var rexYYYYMMDD = /(19|20)\d\d[- \/.](0*[1-9]|1[012])[- \/.](0*[1-9]|[12][0-9]|3[01])/;

	var bRet = rexMMDDYYYY.test(sDate);
	if(!bRet) alert(sMsg);
	return bRet;
}	

// onClientAfterSelectionChanged:"bdpCheckDate('AdvancedSearchTrip_bdpReturnDate', 'Invalid Return Date Entered');"
function bdpCheckDate(sFrom, sMsg)
{
	var bdpFromText  = document.getElementById(sFrom + "_textBox");
	var bRet = dateIsValid(bdpFromText.value, sMsg);
	if(!bRet) bdpFromText.focus();
	return bRet;
}

// onClientAfterSelectionChanged:"bdpDateCopy(this, 'AdvancedSearchTrip_bdpDepartureDate2');"
function bdpDateCopy(bdpFrom, sTo)
{
	var sFromDate = bdpFrom.getSelectedDateFormatted();
	if(!sFromDate) return true;
	// if( !bdpCheckDate(sFromDate, "Date Entries must be in a MM/DD/YYYY format") ) return false;
	var bdpToText  = document.getElementById(sTo + "_textBox");
	if((bdpToText.value) + "" != "") return true;
	bdpToText.value = sFromDate;
	return true;
}


// onClientAfterSelectionChanged:"bdpDateCompare('AdvancedSearchTrip_bdpDepartureDate', 'AdvancedSearchTrip_bdpDepartureDate2');"
function bdpDateCompare(sFrom, sTo, sMsg)
{
	var bdpToText = document.getElementById(sTo + "_textBox");
	var bdpFromText = document.getElementById(sFrom + "_textBox");
	if(!bdpToText || !bdpFromText) return true;			/* no need to evaluate blanks */
	if(bdpToText.value == "" || bdpFromText.value == "") return true;			/* no need to evaluate blanks */
	if(bdpToText.value == "undefined" || bdpFromText.value == "undefined") return true;			/* no need to evaluate blanks */
//	alert("bdpToText = " + bdpToText.value + "\nbdpFromText = " + bdpFromText.vlue);
	
	var dd = dateDiffS(bdpFromText.value, bdpToText.value);
	var bRet = (dd >= 0);
	if(!bRet) alert(sMsg);
	return bRet;
}	

function SetDropDown(obj, objValue)
{
	for (i=0; i <obj.options.length; i++)
	{
		if (obj.options[i].value == objValue)
		{
			obj.options.selectedIndex = i;
			break;
		}
	}
}

function help()
{ 
	window.open("pagecontroller.aspx?productid=" + MM_findObj("__productid").value + "&pageid=Help","helppage","width=850,height=550,left=0,right=0,toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=no");
}

function aspHelp()
{ 
	window.open("/toolbox/mydtwo/mydtwo_help.asp","helppage","width=850,height=550,left=0,right=0,toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=no");
}


function aspMDSearchHelp()
{ 
    var sHelpPage;
    
    if (MM_findObj("__productid").value.toLowerCase() == "md")
    {
        sHelpPage = "/toolbox/mydtwo/mdtutorial/search.asp";
    }
    
	window.open(sHelpPage,"searchhelpmd","width=850,height=550,left=0,right=0,toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=no");
}

/* ITD Menu  58470*/
function aspITDSearchHelp()
{ 
    var sHelpPage;
    
    if (MM_findObj("__productid").value.toLowerCase() == "itd")
    {
        sHelpPage = "/toolbox/mydtit/mdtutorial/itdirect-search.html";
    }
    
	window.open(sHelpPage,"searchhelpitd","width=850,height=550,left=0,right=0,toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=no");
}

function aspHelpITD()
{ 
	window.open("/toolbox/mydtit/mydtit_help.asp","helppage","width=850,height=550,left=0,right=0,toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=no");
}

/* ITD Menu   58545*/
function aspFSDSearchHelp()
{ 
    var sHelpPage;
    
    if (MM_findObj("__productid").value.toLowerCase() == "fsd")
    {
        sHelpPage = "/toolbox/mydtfs/mydtfs_help.asp";
    }
    
	window.open(sHelpPage,"searchhelpfsd","width=850,height=550,left=0,right=0,toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=no");
}

function aspHelpFSD()
{ 
	window.open("/toolbox/mydtfs/mydtfs_help.asp","helppage","width=850,height=550,left=0,right=0,toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=no");
}

function aspINDSearchHelp()
{
	window.open("/toolbox/mydtin/mydtin_help.asp","helppage","width=850,height=550,left=0,right=0,toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=no");
}

function aspPDSearchHelp()
{ 
	window.open("/toolbox/mydtcp/mydtcp_help.asp","helppage","width=850,height=550,left=0,right=0,toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=no");
}

function aspPMDSearchHelp()
{ 
	window.open("/toolbox/mydtwo/mdtutorial/search.asp?section=pmd","helppage","width=850,height=550,left=0,right=0,toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=no");
}

function aspPMDHelp()
{ 
	window.open("/toolbox/mydtpm/mydtpm_help.asp","helppage","width=850,height=550,left=0,right=0,toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=no");
}


//Added

function SetACCookie(name, value, expires, path, domain, secure) {
  document.cookie= name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
}

function GetACCookie(special) {
  var cookieName = (special + "=");
  var i = 0;
  while (i < document.cookie.length) {
    var j = i + cookieName.length;
    if (document.cookie.substring(i, j) == cookieName) return GetACCookieValue(j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
}

function GetACCookieValue(offset) {
  var endString = document.cookie.indexOf (";", offset);
  if (endString) endString = document.cookie.length;
  return unescape(document.cookie.substring(offset, endString));
}

function GetHostNameURL() {
  var tempUrl = document.location.hostname;
  
  if (tempUrl.substr(0, 4) == "www.")
    tempUrl = tempUrl.substring(4);
  
  return tempUrl;
}

//*** get the query string ***//
function GetQString(strValue)
{
    var strResult;
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    var i=0    
        
    while(i<vars.length)
    {
        var pair = vars[i].split("=");
        if(pair[0].toLowerCase() == strValue.toLowerCase())
        {
            strResult = pair[1];
        }
        i=i+1;
    }
        
      return strResult;
}

//*** set focus on the PopUp.aspx page when onload ***//
function openPopUp(strValue)
{
    self.focus();
}

//*** if intFlag = 1, means it will close the pop up, used for advanced search scenario ***//
//*** if intFlag <> 1, it will check whether the popup needs to be closed or remain as is ***//
function closePopUp(strValue,intFlag) 
{
    if(intFlag == 1)
    {
        var myReport = window.open('','SchoolDude',"left=0,top=0, width =0, height =0"); 
        if (myReport != null)
        {
            myReport.close();
        }
    }
    else if(intFlag == 2) // for MSBTripRequest purpose.
    {
        var myReport = window.open('','SchoolDude',"left=0,top=0, width =0, height =0"); 
        if (myReport != null)
        {
            myReport.close();
        }
    
        self.parent.location.href="../../myschoolbuilding/MyRequests.asp?mode=td&Tripid='" + strValue + "'" ;
    }
    else if(intFlag == 3)
    {
        var myReport = window.open('','SchoolDude2',"left=0,top=0, width =0, height =0"); 
        if (myReport != null)
        {
            myReport.close();
        }
    }
    else
    {
         if(GetQString(strValue).toLowerCase() == "close")
        {
            self.close();
        }
    }
} 

function WebPath()
{
    return window.location.protocol + "//" + window.location.host + "/";
}

//*** get the radion button value for the report type on the client scripting ***//
function getCheckedValue(radioObj) 
{
	if(!radioObj)
	{
		return "";
	}
	var radioLength = radioObj.length;
	if(radioLength == undefined)
	{
	    if(radioObj.checked)
	    {
	        strChkBoxReportType = radioObj.value;
			return radioObj.value;
	    }
		else
		{
			return "";
	    }
	}
		
	for(var i = 0; i < radioLength; i++) 
	{
		if(radioObj[i].checked) 
		{
		    strChkBoxReportType = radioObj[i].value;
			return radioObj[i].value;
		}
	}
	return "";
}

//*** for pre-popup purpose, open a popup on client scripting which bypass the popup blocker ***//
function prePopUp(strType)
{    
    var intWidth = 300;
    var intHeight = 200;
    var intLeft = (screen.width/2)-(intWidth/2);
    var intTop = ((screen.height/2)-(intHeight/2) - 100);
    var strURL = "../PopUp.aspx?Type=" + strType + "&productid=" + MM_findObj("__productid").value;
    window.open(strURL,'SchoolDude',"top =" + intTop + ", left = " + intLeft + ",width =" + intWidth + ", height =" + intHeight + ", status=yes, resizable = 1, scrollbars = 1, menubar = 1, location = 0"); 
}

//*** for dialog message popup purpose, it will transfer the information to the pre-popup window ***//
function DialogPopUp(strURL)
{
    var myReport = window.open(strURL,'SchoolDude'); 
    if (myReport != null)
    {
        myReport.resizeTo(600,350); 
    }
}

//*** for alert message popup purpose, it will transfer the information to the pre-popup window ***//
function AlertPopUp(strURL)
{
    var myReport = window.open(strURL,'SchoolDude'); 
    if (myReport != null)
    {
        myReport.resizeTo(400,400); 
    }   
}


//*** for report popup purpose, it will transfer the information to the pre-popup window ***//
function ReportPopUp(strURL)
{       
    var myReport = window.open(strURL,'SchoolDude'); 
    if (myReport != null)
    {
        myReport.moveTo(0,0); 
        myReport.resizeTo(screen.width,screen.height)
    }
}

function ReportPopUp2(strURL,intFlag)
{   
    if(intFlag == 1)
    {
        closePopUp('Close',3);
        var myReport = window.open(strURL,'SchoolDude'); 
        if (myReport != null)
        {
            myReport.moveTo(0,0); 
            myReport.resizeTo(screen.width,screen.height)
        }
    }
    else
    {
        var myReport = window.open(strURL,'SchoolDude'); 
        closePopUp('Close',3);
        if (myReport != null)
        {
            myReport.moveTo(0,0); 
            myReport.resizeTo(screen.width,screen.height)
        }
    }
}

//*** for processing excel report***//
function ExcelPopUp(strURL)
{
    var strBrowserName = navigator.userAgent.toLowerCase()
    
    if (strBrowserName.indexOf("msie") != -1) //if is IE browser
    {
        closePopUp("Close",1);
        setTimeout(function () {self.parent.location.href = strURL;}, 5000); //to remain the page image and positioning
    }
    else
    {
        window.location.href = strURL ;
        closePopUp("Close",1);
    }

}



