//<script language="javascript" type="text/javascript">
    //<![CDATA[
//<!-- hide from JavaScript-challenged browsers

function openWindow(url) {
        popupWin = window.open(url,'new_page','')
}

function clearText(thefield){
if (thefield.defaultValue==thefield.value)
        thefield.value = ""
}

function checkThis(thefield){
if (thefield.value=="")
        thefield.value = thefield.defaultValue
}

function submitButton(button)
{
	if (button='save')
		document.adminForm.submit();
	document.history.go(-1);
}

function submit_Google(){
        var field = document.getElementById('q');
        if (field.value==field.defaultValue)
        {
                alert('Please enter search keyword first.');
        }
        else
                openWindow('http://www.google.com/search\?q='+field.value+'&ie=UTF-8&oe=UTF-8');
}

function submitGoogle (field, event) {
        var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
        if (keyCode == 13)
        {
                openWindow('http://www.google.com/search\?q='+field.value+'&ie=UTF-8&oe=UTF-8');
        }
        else
        return true;
}

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) { //v4.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);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v3.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    if ((nbArr = document[grpName]) != null)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = args[i+1];
      nbArr[nbArr.length] = img;
  } }
}

// JS Calendar
var calendar = null; // remember the calendar object so that we reuse
// it and avoid creating another

// This function gets called when an end-user clicks on some date
function selected(cal, date) {
        cal.sel.value = date; // just update the value of the input field
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks the "Close" (X) button.  It just hides the calendar without
// destroying it.
function closeHandler(cal) {
        cal.hide();                        // hide the calendar

        // don't check mousedown on document anymore (used to be able to hide the
        // calendar when someone clicks outside it, see the showCalendar function).
        Calendar.removeEvent(document, "mousedown", checkCalendar);
}

// This gets called when the user presses a mouse button anywhere in the
// document, if the calendar is shown.  If the click was outside the open
// calendar this function closes it.
function checkCalendar(ev) {
        var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
        for (; el != null; el = el.parentNode)
        // FIXME: allow end-user to click some link without closing the
        // calendar.  Good to see real-time stylesheet change :)
        if (el == calendar.element || el.tagName == "A") break;
        if (el == null) {
                // calls closeHandler which should hide the calendar.
                calendar.callCloseHandler(); Calendar.stopEvent(ev);
        }
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id) {
        var el = document.getElementById(id);
        if (calendar != null) {
                // we already have one created, so just update it.
                calendar.hide();                // hide the existing calendar
                calendar.parseDate(el.value); // set it to a new date
        } else {
                // first-time call, create the calendar
                var cal = new Calendar(true, null, selected, closeHandler);
                calendar = cal;                // remember the calendar in the global
                cal.setRange(1900, 2070);        // min/max year allowed
                calendar.create();                // create a popup calendar
        }
        calendar.sel = el;                // inform it about the input field in use
        calendar.showAtElement(el);        // show the calendar next to the input field

        // catch mousedown on the document
        Calendar.addEvent(document, "mousedown", checkCalendar);
        return false;
}// done hiding -->

//-->
    //]]>
//</script>
