
function help() {
    document.write("<a onMouseover=\"ddrivetip('Click on headings to sort.<br>Move headings sideways to order.<br>Drag headings here to group.')\" onMouseout='hideddrivetip()' class='help'>?</a>");
}

function loadIndicator(){
    var element = document.getElementById('indicator');
    if (element) {
        element.style.display = '';
        setTimeout("document.getElementById('indicator').style.display = 'none';", 10000);
        setTimeout("document.onclick = hideIndicator;", 2000);
    }
}
function hideIndicator(){
    var element = document.getElementById('indicator');
    if (element) {
        element.style.display = 'none';
        document.onclick = null;
    }
}

function killAutofill(){
  is = document.getElementsByTagName("INPUT");
  for(i=0;i<is.length;i++)
    is[i].style.backgroundColor = "";
  ss = document.getElementsByTagName("SELECT");
  for(i=0;i<ss.length;i++)
    ss[i].style.backgroundColor = "";
}
window.onload=killAutofill;

//function used for currency change
function menudirect(URL){
window.location.href = URL;
}

//no spam email address
var user;
var domain;
var suffix;
function nospam(user,domain,suffix) {
	document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">' + user + '@' + domain + '.' + suffix + '</a>');
}

function nospamsml(user,domain,suffix) {
	document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '" class="lnkNBlack10UL">' + user + '@' + domain + '.' + suffix + '</a>');
}

//netscape css fix

function WM_netscapeCssFix() {
   if (document.WM.WM_netscapeCssFix.initWindowWidth != window.innerWidth || document.WM.WM_netscapeCssFix.initWindowHeight != window.innerHeight) {
    document.location = document.location;
  }
}

function WM_netscapeCssFixCheckIn() {
  if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
    if (typeof document.WM == 'undefined'){
      document.WM = new Object;
    }
    if (typeof document.WM.WM_scaleFont == 'undefined') {
      document.WM.WM_netscapeCssFix = new Object;
      document.WM.WM_netscapeCssFix.initWindowWidth = window.innerWidth;
      document.WM.WM_netscapeCssFix.initWindowHeight = window.innerHeight;
    }
    window.onresize = WM_netscapeCssFix;
  }
}

WM_netscapeCssFixCheckIn()

//prevents window from capture in frames

if (top.location != self.location) {
        top.location = self.location
}

//popup windows for references

function popupWindow(referenceHTML, w, h) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	windowProperties = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable'
	reference = window.open(referenceHTML, 'refName', windowProperties)
	if (parseInt(navigator.appVersion) >= 4) { reference.window.focus(); }
	}

function popupAdWindow(referenceHTML, w, h, toolbar, resizable, menubar) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	windowProperties = 'height='+h+',width='+w+',top='+wint+',left='+winl+',toolbar='+toolbar+',scrollbars=yes,resizable='+resizable+', menubar='+menubar+''
	reference = window.open(referenceHTML, 'refName', windowProperties);
	if (parseInt(navigator.appVersion) >= 4)
		reference.window.focus();
}

function ConfirmDelete()
{
	if (confirm("Are you sure you want to delete this item?") == true)
		return true;
	else
		return false;
}

function PrintThisPage() 
{ 
	var w = 700;
	var h = 450;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var sOption = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable';
   	var sWinHTML = "<html>\n<head>\n<title>Activities4KIDS</title>\n";
   	sWinHTML += "<link rel='stylesheet' href='/inc/admin_stylesheetP.css' type='text/css'>\n";
   	sWinHTML += "</head>\n";
   	sWinHTML += "<body>\n";
   	sWinHTML += document.getElementById('reportarea').innerHTML;
   	sWinHTML += "\n</body>\n</html>";
   		
   	var winprint=window.open("","PrintWindow",sOption);
   	if (winprint == null)
   		winprint=document.PrintWindow;

	winprint.document.open(); 
	winprint.document.write(sWinHTML); 
	winprint.document.close(); 
	winprint.print();
	//winprint.close();
}

function open_win(what_link,the_x,the_y,toolbar,addressbar,directories,statusbar,menubar,scrollbar,resize,history,pos,wname){
	var the_url = what_link;
	the_x -= 0;
	the_y -= 0;
	var how_wide = screen.availWidth;
	var how_high = screen.availHeight;
	if(toolbar == "0"){var the_toolbar = "no";}else{var the_toolbar = "yes";}
	if(addressbar == "0"){var the_addressbar = "no";}else{var the_addressbar = "yes";}
	if(directories == "0"){var the_directories = "no";}else{var the_directories = "yes";}
	if(statusbar == "0"){var the_statusbar = "no";}else{var the_statusbar = "yes";}
	if(menubar == "0"){var the_menubar = "no";}else{var the_menubar = "yes";}
	if(scrollbar == "0"){var the_scrollbars = "no";}else{var the_scrollbars = "yes";}
	if(resize == "0"){var the_do_resize =  "no";}else{var the_do_resize = "yes";}
	if(history == "0"){var the_copy_history = "no";}else{var the_copy_history = "yes";}
	if(pos == 1){top_pos=0;left_pos=0;}
	if(pos == 2){top_pos = 0;left_pos = (how_wide/2) -  (the_x/2);}
	if(pos == 3){top_pos = 0;left_pos = how_wide - the_x;}
	if(pos == 4){top_pos = (how_high/2) -  (the_y/2);left_pos = 0;}
	if(pos == 5){top_pos = (how_high/2) -  (the_y/2);left_pos = (how_wide/2) -  (the_x/2);}
	if(pos == 6){top_pos = (how_high/2) -  (the_y/2);left_pos = how_wide - the_x;}
	if(pos == 7){top_pos = how_high - the_y;left_pos = 0;}
	if(pos == 8){top_pos = how_high - the_y;left_pos = (how_wide/2) -  (the_x/2);}
	if(pos == 9){top_pos = how_high - the_y;left_pos = how_wide - the_x;}
	if (window.outerWidth){
		var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",outerWidth="+the_x+",outerHeight="+the_y+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
		wname=window.open(the_url, "OpenWindow", option);
		if (wname == null)
   			wname=document.OpenWindow;

		if (wname != null)
			wname.focus();
	}
	else
	{
		if (!the_x)
			the_x = 800
		if (!the_y)
			the_y = 600

		var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",Width="+the_x+",Height="+the_y+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
		if (!wname.closed && wname.location){
			wname.location.href=the_url;
		}
		else
		{
			wname=window.open(the_url, "OpenWindow", option);
			if (wname == null)
   				wname=document.OpenWindow;
			
			if (wname != null) {
				//wname.resizeTo(the_x,the_y);
				wname.focus();
				wname.location.href=the_url;
			}
		}
	}
}

function FlashControl(ClsId,Url,Width,Height,AutoStart)
{
	document.write('<object classid="' + ClsId + '" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + Width + '" height="' + Height + '">')
	document.write('<param name="movie" value="' + Url + '">')							  
	document.write('<param name="wmode" value="transparent">')
	document.write('<param name="quality" value="high">')
	document.write('<embed src="' + Url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + Width + '" height="' + Height + '" wmode="transparent"></embed>')
	document.write('</object>')
}

/*<div style="width:250px; height:250px; position:absolute; right:30px; top:-100px">    <object id="flashObject" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="250" height="240">
	<param name="movie" value="/img/map-east.swf?State=">						  
	<param name="wmode" value="transparent">
	<param name="quality" value="high">
	<param name="allowScriptAccess" value="always" />
	<embed name="flashObject" src="/img/map-east.swf?State=" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="250" height="240" wmode="transparent" swLiveConnect="true" allowScriptAccess="always"></embed>
	</object>
</div>*/

function FlashControlId(ClsId,Url,Width,Height,AutoStart,FlashId)
{
	document.write('<object id="' + FlashId + '" classid="' + ClsId + '" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + Width + '" height="' + Height + '">')
	document.write('<param name="movie" value="' + Url + '">')							  
	document.write('<param name="wmode" value="transparent">')
	document.write('<param name="quality" value="high">')
	document.write('<embed name="' + FlashId + '" src="' + Url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + Width + '" height="' + Height + '" wmode="transparent"></embed>')
	document.write('</object>')
}

function FlashControlSSL(ClsId,Url,Width,Height,AutoStart)
{
	document.write('<object classid="' + ClsId + '" width="' + Width + '" height="' + Height + '">')
	document.write('<param name="movie" value="' + Url + '">')							  
	document.write('<param name="wmode" value="transparent">')
	document.write('<param name="quality" value="high">')
	document.write('<embed src="' + Url + '" quality="high" type="application/x-shockwave-flash" width="' + Width + '" height="' + Height + '" wmode="transparent"></embed>')
	document.write('</object>')
}

//popup windows for calculators

function getQuerystring (qParam) {
    var qValue = '';
    var url = document.location + '';
    qString=url.split('?');
    if (qString[1]) {
        //Get all Name/Value pairs from the QueryString
        var pairs = qString[1].split('&');
        for (i=0;i<pairs.length;i++) {
            //Get the Name from given Name/Value pair
            var keyval = pairs[i].split('=');
            if (keyval[0] == qParam) {
                //Get the Value from given Name/Value pair and set to the return ID
                qValue = keyval[1];
            }
        }
    }
    return qValue;
}

function popupCalculator(mypage,myname,w,h,scroll) {
	var wi = screen.width - 100;
	var he = screen.height - 100;
	var winl = (screen.width - wi) / 2;
	var wint = ((screen.height - he) / 2) - 20;
	winprops = 'height='+he+',width='+wi+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function Help(msg) {
    document.write("<a onMouseover=\"ddrivetip('" + msg + "')\" onMouseout='hideddrivetip()' class='help'>?</a>");
}

function thisMovie(movieName) {
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    return (isIE) ? window[movieName] : document[movieName];
} 

function selectState(stateCode, stateValue) {
    if (stateCode != '') {
        switch (stateCode) {
            case 'VIC': stateValue = 1;break;
            case 'NSW': stateValue = 2;break;
            case 'QLD': stateValue = 3;break;
            case 'NT': stateValue = 4;break;
            case 'WA': stateValue = 5;break;
            case 'SA': stateValue = 6;break;
            case 'TAS': stateValue = 7;break;
            case 'ACT': stateValue = 8;break;
            default: stateValue = -1;break;
        }
    }
    else {
        switch (parseInt(stateValue)) {
            case 1: stateCode = 'VIC';break;
            case 2: stateCode = 'NSW';break;
            case 3: stateCode = 'QLD';break;
            case 4: stateCode = 'NT';break;
            case 5: stateCode = 'WA';break;
            case 6: stateCode = 'SA';break;
            case 7: stateCode = 'TAS';break;
            case 8: stateCode = 'ACT';break;
            default: stateValue = -1;break;
        }
    }
    if (stateValue > -1) {
        var ddlState = document.getElementById('ctl00_ContentHolder_ddlState');
        for(i=0;i<ddlState.options.length;i++) {
           if (ddlState.options[i].value == stateValue) {
                ddlState.selectedIndex=i;
                // Uses ExternalInterface to pass to flash
                flashMovie = thisMovie("flashObject");
                flashMovie.htmlSelectState(stateCode);
                __doPostBack('ctl00_ContentHolder_ddlState','');
            }
        }
    }
    else {
        flashMovie = thisMovie("flashObject");
        flashMovie.htmlSelectState('ALL');
    }
}
/*
window.onload = function (){
    aspnetForm.flashObject.htmlSelectState = function(val)
    {string1 = "<invoke name=\"htmlSelectState\" returntype=\"javascript\"><arguments><string>"+val+"</string></arguments></invoke>"
    aspnetForm.flashObject.CallFunction(string1) }
}
*/