﻿var popUp; 

function OpenCalendar(idname, postBack)
{
	popUp = window.open('Calendar.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=165,height=208,left=200,top=250');
}

function SetDate(formName, id, newDate, postBack)
{
	eval('var theform = document.' + formName + ';');
	popUp.close();
	theform.elements[id].value = newDate;
	if (postBack)
		__doPostBack(id,'');
}	

//  POP UP WINDOW FUNCTION
function windowOpener(what_url,winheight,winwidth) {
	options="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+winwidth+",height="+winheight;

	popwin = window.open(what_url,'pop_win',options);
	popwin.focus();
}

//var bookmarkurl="http://localhost:2319/rms/index.aspx"
var bookmarkurl="http://localhost/rms/index.aspx"
var bookmarktitle="Radiology Management Service"

function addbookmark(){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function showHourGlass()
{
    document.body.style.cursor = 'wait';
}

 function ExpandCollapse(obj,row)
    {
        var div = document.getElementById(obj);
        var img = document.getElementById('img' + obj);
        
        if (div.style.display == "none")
        {
            div.style.display = "block";
            if (row == 'alt')
            {
                img.src = "../images/minus.gif";
            }
            else
            {
                img.src = "../images/minus.gif";
            }
            img.alt = "Close to view other Members";
        }
        else
        {
            div.style.display = "none";
            if (row == 'alt')
            {
                img.src = "../images/plus.gif";
            }
            else
            {
                img.src = "../images/plus.gif";
            }
            img.alt = "Expand to show Salary";
        }
    } 
    
    //Generating Pop-up Print Preview page
	function getPrint(print_area)
	{ 
	document.getElementById(strbtnPrintID).style.visibility = 'hidden';  
    document.getElementById(strlnkImg).style.visibility = 'hidden'; 
    document.getElementById(print_area).stylefontSize = '10px';
      
	//Creating new page
	var pp = window.open();
	//datetime
	
	var currentTime = new Date()
    var month = currentTime.getMonth() + 1
    var day = currentTime.getDate()
    var year = currentTime.getFullYear()
   
	var currentTime = new Date()
    var hours = currentTime.getHours()
    var minutes = currentTime.getMinutes()
  
  
	//Adding HTML opening tag with <HEAD> … </HEAD> portion 
	pp.document.writeln('<HTML><HEAD><title>Print Preview</title>')
	//pp.document.writeln('<LINK href=css/uhb_styles.css type="text/css" rel="stylesheet">')
	//pp.document.writeln('<LINK href=PrintStyle.css type="text/css" rel="stylesheet" media="print">')
	pp.document.writeln('<base target="_self"></HEAD>')//Adding Body Tag
	pp.document.writeln('<body MS_POSITIONING="GridLayout" bottomMargin="0"');
	pp.document.writeln(' leftMargin="0" topMargin="0" rightMargin="0">');
	pp.document.writeln('<br /><h3>Print Preview</h3><br />');
	//Adding form Tag
	pp.document.write("Report Printed:<br>");
    pp.document.writeln(day + "/" + month + "/" + year)
    pp.document.writeln(hours + ":" + minutes + " ")
    if(hours > 11){
        pp.document.writeln("PM")
    } else {
        pp.document.writeln("AM")
    }
    pp.document.write("<br>");
	pp.document.writeln('<form method="post">');//Creating two buttons Print and Close within a HTML table
	pp.document.writeln('<TABLE style=""FONT-SIZE: 9pt; FONT-FAMILY: Arial; TEXT-DECORATION: none""><TR><TD></TD></TR><TR><TD align=left>');
	pp.document.writeln('<INPUT ID="PRINT" type="button" value="Print" ');
	pp.document.writeln('onclick="javascript:location.reload(true);window.print();">');
	pp.document.writeln('<INPUT ID="CLOSE" type="button" value="Close" onclick="window.close();">');
	pp.document.writeln('</TD></TR><TR><TD></TD></TR></TABLE>');//Writing print area of the calling page
	pp.document.writeln('<TABLE style=""FONT-SIZE: 9pt; FONT-FAMILY: Arial; TEXT-DECORATION: none""><tr><td>');
	pp.document.writeln(document.getElementById(print_area).innerHTML);
	pp.document.writeln('</td></tr></table>');
	//Ending Tag of </form>, </body> and </HTML>
	pp.document.writeln('</form></body></HTML>'); 
	} 