//global constant variables declared here
var g_contactAddress;
g_contactAddress = "First Floor, H Building, Orient Colony, Dhumbarahi, Kathmandu, Nepal.  Tel: +977-1-4421511, 4410756  Fax: +977-1-4427306  E-mail: nids@mail.com.np";


//function to print date, time
function PrintDate()
{
	var t,strDate;
	t = new Date();
	strDate = getDayName(t.getDay()) + ", " + t.getDate() +  " " + getMonthName(t.getMonth()) + ", " + t.getFullYear();
	document.write(strDate);
}

//function to return the name of the month
function getMonthName(intMonth)
{
	var strMonth;
	if(intMonth == 0)
		strMonth = "January";
	if(intMonth == 1)
		strMonth = "February";
	if(intMonth == 2)
		strMonth = "March";
	if(intMonth == 3)
		strMonth = "April";
	if(intMonth == 4)
		strMonth = "May";
	if(intMonth == 5)
		strMonth = "June";
	if(intMonth == 6)
		strMonth = "July";
	if(intMonth == 7)
		strMonth = "August";	
	if(intMonth == 8)
		strMonth = "September";
	if(intMonth == 9)
		strMonth = "October";
	if(intMonth == 10)
		strMonth = "November";	
	if(intMonth == 11)
		strMonth = "December";	
		
	return strMonth;	
}

//function to return the name of the day
function getDayName(intDay)
{
	var strDay;
	if(intDay == 0)
		strDay = "Sunday";
	if(intDay == 1)
		strDay = "Monday";
	if(intDay == 2)
		strDay = "Tuesday";
	if(intDay == 3)
		strDay = "Wednesday";
	if(intDay == 4)
		strDay = "Thrusday";
	if(intDay == 5)
		strDay = "Friday";
	if(intDay == 6)
		strDay = "Saturday";
		
	return strDay;	
}

//global variable for status scrolling texts
var timeID = 10;
var stcnt = 16;
var wmsg = new Array(33);

//function to initialize status scroller text
function setStatus(msg)
{
	
	var blank,i,b;
	
	wmsg[0]=msg;
    blank = "                                                               ";
    for (i=1; i<32; i++)
    {
		b = blank.substring(0,i);
        wmsg[i] = "";
        for (j=0; j<msg.length; j++) 
		{
			wmsg[i] = wmsg[i] + msg.charAt(j) + b;
		}
    }
		
	wiper(); // this function will display scroller text in status bar
}

//function to display scrolling text on statusbar
function wiper()
{
	var str;
	
	if (stcnt > -1) str = wmsg[stcnt]; else str = wmsg[0];
    if (stcnt-- < -40) stcnt=31;
    status = str;
    clearTimeout(timeID);
    timeID = setTimeout("wiper()",100);
}

// This function open a popup with specified photo
function OpenPhoto(strTitle,strFile,iWidth,iHeight)
{
	var iTop,iLeft;
	var oWin,oWinContent;

	iTop = (screen.height - iHeight-50)/2;
	iLeft = (screen.width - iWidth-20)/2;		
	
	if(iLeft < 0) iLeft = 0;	if(iTop < 0) iTop = 0;
	
	oWinContent = "<html><head><title>HDI Gallery : " + strTitle + "</title></head>"
	oWinContent = oWinContent + "<body style='margin:0px;padding:0px'><img src='" + strFile + "' class='general'></body></html>"
	
	oWin = window.open("","","width="+iWidth+",height="+iHeight+",top="+iTop+",left="+iLeft+",toolbar=no,status=no,menubar=no,resizable=no,scrollbars=no");
	oWin.document.write(oWinContent);	
}


//This function opens a new window with given URL
function OpenURL(strURL)
{
	window.open(strURL);
}
