
//DISABLE RIGHTCLICK

//var message="";

//function clickIE()
//{
//	if (document.all)
//	{
//		(message);return false;
//	}
//}

//function clickNS(e)
//{
//	if
//	(document.layers||(document.getElementById&&!document.all))
//	{
//		if (e.which==2||e.which==3)
//			{
//			(message);return false;
//			}
//	}
//}

//if (document.layers)
//{
//	document.captureEvents(Event.MOUSEDOWN);
//	document.onmousedown=clickNS;
//}
//else
//{
//	document.onmouseup=clickNS;document.oncontextmenu=clickIE;
//}

//document.oncontextmenu=new Function("return false")


//function disable_rightclick()
//{
//var message="";

//function clickIE()
//{
//	if (document.all)
//	{
//		(message);return false;
//	}
//}

//function clickNS(e)
//{
//	if
//	(document.layers||(document.getElementById&&!document.all))
//	{
//		if (e.which==2||e.which==3)
//			{
//			(message);return false;
//			}
//	}
//}

//if (document.layers)
//{
//	document.captureEvents(Event.MOUSEDOWN);
//	document.onmousedown=clickNS;
//}
//else
//{
//	document.onmouseup=clickNS;document.oncontextmenu=clickIE;
//}

//document.oncontextmenu=new Function("return false")
//}



//Basic functions required by image rollovers created from dreamweaver and fireworks

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



//DATE FUNCTIONS

var mydate=new Date();
var year=mydate.getYear();
if (year < 1000)
year+=1900;

function show_full_date()
{
var mydate=new Date();
var year=mydate.getYear();

if (year < 1000)
	year+=1900;
	var day=mydate.getDay();
	var month=mydate.getMonth();
	var daym=mydate.getDate();

if (daym<10)
	daym="0"+daym;
	
	var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	document.write(dayarray[day]+", "+montharray[month]+" "+daym+", "+year);
}


//Shows year only eg: 2002
function show_year()
{
document.write(year);
}

//count footer
function show_footer() 
{
document.write("");
}

//NEW WINDOW SCRIPTS
function new_win(w,h,location)
{

var wide = w;
var high = h;

window.open(location, "new_win", "resizable=no, scrollbars=no, toolbar=no, location=no, directories=no, status=no, menubar=no, width="+wide+", height="+high+", top=0, left=0,innerHeight=0,innerWidth=0,outerHeight=0,outerWidth=0,channelmode=0")

}


function newwin(url,name,features) {
		
  window.open(url,name,features);
}
/*===========================================
function replaceAll(str, lookfor, repl) {
  while (str.indexOf(lookfor) != -1) 
    str = str.replace(lookfor, repl);
  return str;
}

// function that finds all image tags within a given string
function getImageTags(str) {

	var imgTags = new RegExp("<img.+?src\s*=\s*([\"']?)(.+?[\.jpg|\.gif\])([\"']).*?>", "gi");
	var imgTagsArray = str.match(imgTags);	
	
	return imgTagsArray;
}

function replaceImages(url, str) {

	var new_url;
	var imgtags = getImageTags(str);
	
	if (imgtags != null) {
		for (i=0; i < imgtags.length; i++) {			
			src_indx = imgtags[i].indexOf("src="); // find index of "src"
			src_addr = imgtags[i].substring(src_indx, imgtags[i].length); // get the image filename		
			first_space_indx = src_addr.indexOf(" ");
			old_src_addr = src_addr.substring(0, first_space_indx);
			filename = old_src_addr.substring( (old_src_addr.indexOf("=") +2), old_src_addr.length-1);
			new_url = "src=" + url.substring(0, (url.lastIndexOf("/")) ) + "/" + filename;
			str = str.replace(old_src_addr, new_url);
		}
	}
	return str;
}
function Print()
{
	var filepath = parent.main.location.href; // get url of frame
	
	if (filepath.lastIndexOf(".asp") > 0 || filepath.lastIndexOf(".htm") > 0 || filepath.lastIndexOf(".asp#") > 0 || filepath.lastIndexOf(".htm#") > 0) {
	
		// get the html content of current page in the iframe
		var headCodes = parent.main.document.all.tags("HEAD")[0].innerHTML;
		var body_style = "<style>body { margin-left:10;margin-right:30; padding: 0; float: none}</style>";
		
		var htmlCodes = "<head>" + body_style + headCodes + "</head>" + "<body onload=window.print();window.close();>" + parent.main.document.all.tags("BODY")[0].innerHTML;
		
		/*htmlCodes = replaceAll(htmlCodes, "width=780", "width=100%");
		htmlCodes = htmlCodes.replace("width=600", "width=77%");
		htmlCodes = htmlCodes.replace("width=180", "width=23%");
		
		htmlCodes = replaceImages(filepath, htmlCodes);
		
		var mywin;
		mywin = window.open('','Print_Preview','resizable=no,toolbars=no,location=no,status=no,menubar=no, scrollbars=yes');		
		mywin.document.write("<table border=0 width=100%><tr><td>");
		mywin.document.write(htmlCodes);
		mywin.document.write("</td></tr></table></body></html>");
		mywin.location.reload(); // reload current page to bring up the print dialog box
			
	} else {
		// print out what's in the iframe for word docs, excel, ppoint and pdf files
		parent.main.focus();
		parent.main.print();
	}
	
}
// function that displays either the print or save option depending on which type of document is currently being viewed
var url;
function displayOptions() {
	
	var filepath = parent.main.location.href; // get url of frame

	// check what extension it is. if its asp or htm, then just display the print link
	if (filepath.lastIndexOf(".asp") > 0 || filepath.lastIndexOf(".htm") > 0 || filepath.lastIndexOf(".asp#") > 0 || filepath.lastIndexOf(".htm#") > 0) {
		document.all.cella.innerHTML = "<div align='center' style='cursor:hand'><img onClick=Print(); onmouseover=document.all.cella.focus(); src='images/print.gif' width='19' height='15'></div>";
		document.all.cellb.innerHTML = "<div align='left'><a href=javascript:Print(); class='sidebar_mainheading_white' onmouseover=document.all.cellb.focus();>Print</a></div>";
		document.all.cellc.innerHTML = "";
		document.all.celld.innerHTML = "";
	} 
	if (filepath.lastIndexOf(".doc") > 0 || filepath.lastIndexOf(".xls") > 0 || filepath.lastIndexOf(".ppt") > 0 || filepath.lastIndexOf(".pdf") > 0) { // the case for word, excel, powerpoint and pdf docs
		/* used onmouseover event to set focus to these two table cells as for some reasons you have to double click in order
		   for the links to activate
		*
		var dirpaths = filepath.split("/");
		var phy_path = "";
		
		for (i=3; i < dirpaths.length; i++) {
			phy_path = phy_path + "/" + dirpaths[i];
		}
		
		url = "./save.asp?File=" + phy_path;
		
		document.all.cella.innerHTML = "<div align='center' style='cursor:hand'><img onClick=Print(); onmouseover=document.all.cella.focus(); src='images/print.gif' width='19' height='15'></div>";
		document.all.cellb.innerHTML = "<div align='left'><a href=javascript:Print(); class='sidebar_mainheading_white' onmouseover=document.all.cellb.focus();>Print</a></div>";
		document.all.cellc.innerHTML = "<div align='center' onClick=startTimer();openSaveBox(); style='cursor:hand'><img src='images/save.gif' border='0' width='19' height='15' onmouseover=document.all.cellc.focus();></div>";
		document.all.celld.innerHTML = "<div class='sidebar_mainheading_white' align='left' onClick=startTimer();openSaveBox(); onmouseover=document.all.celld.focus(); style='cursor:hand'><u>Save</u></div>";
	}
}
//the two functions below opens up a hidden window to load the save as box and then closes it after 2 sec
var savewin, start, end, diff;

function openSaveBox() {

	savewin = window.open(url, "", 'width=1, height=1, top=' + screen.width + ', left=' + screen.height + '');
	savewin.onBlur = stopTimer();
	this.focus();
	
	diff = end - start;
	
	if (diff < 1000) {
		diff = 5000;
	}
	self.setTimeout("savewin.close()", diff);	
}

function startTimer() {

	start = (new Date()).getTime();
	
} // function startTimer

function stopTimer() {

	end = (new Date()).getTime();
	
} // function stopTimer*/
