<!--


// This is the cool show/hide script that can be used for any object
// Many thanks to my evolter co-admin Jeff Howden - http://evolt.jeffhowden.com - for his help with this.
// Visit Jeff's site for many other cool Javascript goodies and sample scripts

  var toggledDisplay = new Object();
      toggledDisplay['emailform'] = false;
      toggledDisplay['biggerbox'] = false;
      toggledDisplay['spanshowlinks'] = true;
      toggledDisplay['nextten'] = false;
      toggledDisplay['linksblog'] = false;



  function toggleDisplayed(bDisplayed)
  {
    if(!document.getElementById || toggleDisplayed.arguments.length < 2) return;
    var displayed = new Object();
        displayed['true'] = 'block';
        displayed['false'] = 'none';
    for(var i = 1; i < toggleDisplayed.arguments.length; i++)
    {
      oDisplay = document.getElementById(toggleDisplayed.arguments[i]);
      if(oDisplay)
      {
        oDisplay.style.display = displayed[bDisplayed];
        if(typeof toggledDisplay[toggleDisplayed.arguments[i]] != 'undefined')
          toggledDisplay[toggleDisplayed.arguments[i]] = !bDisplayed;
      }
    }
  }
  
  
function ResizeBox()
{
document.forms[0].elements['text'].rows = 30;                                                         // Make the box bigger
document.getElementById('biggerbox').style.display="none";                        //Make the link disappear
document.forms[0].elements['text'].focus();                                                             // Return focus to the textarea
return false;                                                                                                                         // MadMan, you rock
}

function openWin(wName, wWidth, wHeight, wResize)
			{
			  features = 'toolbar=0, location=0, directories=0, menubar=0, scrollbars=0,status=1,resizable=' + ((wResize) ? 1 : 0) + ((wWidth) ? ',width=' + wWidth : '') + ((wHeight) ? ',height=' + wHeight : '');
			  popWin = window.open('', wName, features);
        if(popWin.focus) { popWin.focus(); }
        return true;
			}
			


			
function ExpandWindow(WindowName)
{
document.getElementById(WindowName).style.visibility = "visible";
}

function CollapseWindow(WindowName)
{
document.getElementById(WindowName).style.visibility = "hidden";
}

			
function ShowWindow(WindowName)
{
// document.getElementById(WindowName).style.visibility = "visible";
document.getElementById(WindowName).style.display = "block";
}

function HideWindow(WindowName)
{
// document.getElementById(WindowName).style.visibility = "hidden";
document.getElementById(WindowName).style.display = "none";
}


function HideNavBar(WindowName)
{
HideWindow(WindowName);
document.getElementById("main").style.width = "90%";
CollapseWindow("hideme");
ExpandWindow("showme");
}

function ShowNavBar(WindowName)
{
ShowWindow(WindowName);
document.getElementById("main").style.width = "55%";
CollapseWindow("showme");
ExpandWindow("hideme");
}

function OpenComments (c) {
   window.open(c, 'comments', 'width=550,height=480,scrollbars=yes,resizable=yes,status=yes');
}


function OpenTrackback (c) {
    window.open(c,
                    'trackback',
                    'width=480,height=480,scrollbars=yes,resizable=yes,status=yes');
}

/*
Required field(s) validation
*/

function formCheck(formobj){
	//1) Enter name of mandatory fields
	var fieldRequired = Array("author", "email", "message");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("Your name", "Your email address", "A damn message!");
	//3) Enter dialog message
	var alertMsg = "OY! You forgot to fill in:\n\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		// submitonce(formobj);
		return openWin(formobj.target, 500, 400, true);
		toggleDisplayed(toggledDisplay['emailform'], 'emailform'); 
		return true;
	
	}else{
		alert(alertMsg);
		return false;
	}
}


// Form field highlight code


var highlightcolor="#FFFFEE"

var ns6=document.getElementById&&!document.all
var previous=''
var eventobj

//Regular expression to highlight only form elements
var intended=/INPUT|TEXTAREA|SELECT|OPTION/

//Function to check whether element clicked is form element
function checkel(which){
if (which.style&&intended.test(which.tagName)){
if (ns6&&eventobj.nodeType==3)
eventobj=eventobj.parentNode.parentNode
return true
}
else
return false
}



//Function to highlight form element
function highlight(e){
eventobj=ns6? e.target : event.srcElement
if (previous!=''){
if (checkel(previous))
previous.style.backgroundColor=''
previous=eventobj
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
}
else{
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
previous=eventobj
}
}

			
			




// FORMATTING TOOLBAR FUNCTIONS

function mouseover(el) {
el.className = "raised";
}

function mouseout(el) {
el.className = "button";
}

function mousedown(el) {
el.className = "pressed";
}

function mouseup(el) {
el.className = "raised";
}


function format_me(v) {
var str = document.selection.createRange().text;
document.comments_form.text.focus();
if (str != '')
{
document.selection.createRange().text = "<" + v + ">" + str + "</" + v + ">";
}
return;
}

function insert_link() {
var str = document.selection.createRange().text;
document.comments_form.text.focus();
var my_link = prompt("Enter URL:","http://");
if (my_link != null) {
document.selection.createRange().text = "<a href=\"" + my_link + "\">" + str + "</a>";
}
return;
}


function showMore(varA1, varB1)

{
	if( document.getElementById ) 
	{
		if( document.getElementById(varA1).style.display ) 

		{

                 document.getElementById(varA1).style.display = "block";
                 document.getElementById(varB1).style.display = "none";
		} 

	}
}
//-->
