    <!-- //

    function externalLinks() {
        if (!document.getElementsByTagName) return;
        var anchors = document.getElementsByTagName("a");

        for (var i = 0; i < anchors.length; i++) {
            var anchor = anchors[i];
            if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
                anchor.target = "_blank";
        }
    }

    //New window function for rotostack (and elsewhere)
    function newWindow(url, height, width) {
        nameW = 'feature'

        if (navigator.appVersion.indexOf('4') != -1) {
            xTop = screen.width / 2 - (width / 2);
            yTop = screen.height / 2 - (height / 2);

            window.open(url, nameW, 'height='+height+',width='+width+',scrollbars=1,resizable=1,menubar=1,toolbar=1,status=1,location=1,directories=1,left=' + xTop + ',top=' + yTop + '');
        }
        else
        {
            window.open(url, nameW, 'height='+height+',width='+width+',scrollbars=1,resizable=1,menubar=1,toolbar=1,status=1,location=1,directories=1,left=150,top=200');
        }
    }

function fncOpenWindow(strURL, strTarget, intWidth, intHeight, blnToolbar, blnMenubar, blnScrollbars, blnResizable) {
	var params;
	var displaymode;

	if (intWidth + intHeight == 0) { 
		displaymode = "fullscreen=yes,";
	}
	else {
		displaymode = "width=" + intWidth + ",height=" + intHeight + ",";
	}

	params = "toolbar=" + blnToolbar + ",location=0,directories=0,status=0,menubar=" + blnMenubar + ",scrollbars=" + blnScrollbars + ",resizable=" + blnResizable + "," + displaymode;

	objWindow = window.open(strURL, strTarget, params)
}


    //helpWindow has no menubar or toolbar and cannot be resized
    function helpWindow(url, height, width) {
        nameW = 'feature'

        if (navigator.appVersion.indexOf('4') != -1) {
            xTop = screen.width / 2 - (width / 2);
            yTop = screen.height / 2 - (height / 2);

            window.open(url, nameW, 'height='+height+',width='+width+',scrollbars=1,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=' + xTop + ',top=' + yTop + '');
        }
        else
        {
            window.open(url, nameW, 'height='+height+',width='+width+',scrollbars=1,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=150,top=200');
        }
    }

    //jobWindow has no menubar or toolbar, but can be resized
    function jobWindow(url, height, width, jobid) {
        nameW = 'feature' + jobid;

        if (navigator.appVersion.indexOf('4') != -1) {
            xTop = screen.width / 2 - (width / 2);
            yTop = screen.width / 2 - (width / 2);

            window.open(url, nameW, 'height='+height+',width='+width+',scrollbars=1,resizable=1,menubar=0,toolbar=0,status=0,location=0,directories=0,left='+xTop+',top='+yTop+'');
        }
        else
        {
            window.open(url, nameW, 'height='+height+',width='+width+',scrollbars=1,resizable=1,menubar=0,toolbar=0,status=0,location=0,directories=0,left=150,top=200');
        }
    }

    function CheckAll(checkAllBox)
    {
        var frm = document.aspnetForm;
        var ChkState = checkAllBox.checked;

        for(i = 0; i < frm.length; i++)
        {
            e = frm.elements[i];
            if(e.type=='checkbox' && e.name.indexOf('Id') != -1)
            e.checked = ChkState;
        }
    }

    function CheckChanged()
    {
        var frm = document.aspnetForm;
        var boolAllChecked;

        boolAllChecked = true;

        for(i = 0; i < frm.length; i++)
        {
            e = frm.elements[i];
            if (e.type == 'checkbox' && e.name.indexOf('Id') != -1)
            if(e.checked == false)
            {
                boolAllChecked = false;
                break;
            }
        }

        for(i=0;i< frm.length;i++)
        {
            e = frm.elements[i];

            if (e.type == 'checkbox' && e.name.indexOf('checkAll') != -1)
            {
                if(boolAllChecked == false)
                    e.checked = false ;
                else
                    e.checked = true;
                    break;
            }
        }
    }
    function FormatString(str)
        {
            if (str.length <= 0) { return "00";}
            if (str.length == 1) { return "0" + str;}
            if (str.length > 1) { return str;}         
        }
    //function to read data from excel file
    function btnpreviewYmlpData()
        {
           //alert(document.getElementById('ctl00_Body_fileUploadEmail').value);
            var Excel,tmpEmail,tmpStart, tmpStr, blnFlag;
            try
            {
            //  document.getElementById('btnPreview').disabled = true;
              blnFlag=true;
    
                Excel = new ActiveXObject("Excel.Application");
    
	            Excel.Visible = false;
	            var str = Excel.Workbooks.Open(document.getElementById('ctl00_Body_fileUploadEmail').value).Sheets(1);
	            var str1="<?xml version='1.0'?><NewDataSet>"
	            var i=2,tmpDate,tmpMnth;
	
	            while (str.Cells(i,1).Value != undefined)
	             {  
	                var tmp1=str.Cells(i,1).Value;
	                
      	            tmpEmail = "<EmailAddress>" + tmp1 + "</EmailAddress>";       	                

	                var tmp = new Date(str.Cells(i,6).Value);           
	                if (str.Cells(i,6).Value != undefined && tmp !="NaN")
	                {            
	                //    tmpStart = "<Date>" + FormatString(tmp.getDate().toString())+ "-"+FormatString((tmp.getMonth() + 1).toString()) + "-" + tmp.getFullYear().toString()+ "</Date>";
	                    tmpStart = "<Date>" + tmp.getFullYear().toString()+"-"+FormatString((tmp.getMonth() + 1).toString()) + "-" + FormatString(tmp.getDate().toString()) + "</Date>";
	                    
	                }
	                str1 = str1 + "<Table>" + tmpEmail + tmpStart + "<Status></Status></Table>";
	                tmpEmail="";	                
	                tmpStart="";	                
	                i=i+1;
    	            
	           };
	          str1=str1 + "</NewDataSet>"
	       	  if (blnFlag==false) { return 0;}
	  //     	  alert(str1);
	          document.getElementById('excelinput').value=str1;
	          document.getElementById('previewclick').value=1;	          
	  //      document.form1.submit();
            }
             catch(e)
            {
	            if(e.message == "Automation server can't create object")
		            alert("In order for this page to upload documents, you must enable the feature to\n'Initialize and script ActiveX controls not marked as safe'\n under security settings for IE.");
		        else if (e.number == -2146827284)
		            alert("Invalid File. Please select an excel file for upload");
		        else if (e.number == -2146823281)
		            alert("The column data type is invalid. All columns in the spreadsheet should be of type text");
	            else
		            alert("Exception: " + e.message );
	            
		            return 0;
            }
	        finally
            {
                if (Excel != null)                
                    Excel.Application.Quit(); 
                document.getElementById('btnPreview').disabled = false; 
                document.getElementById('previewclick').value=1;	
           
            }
        }
    // -->
