// JavaScript Document
popUpWin = 0;
function popUpWindow(URLStr, title, left, top, width, height,id)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, title, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollBars=no,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


function popUpWindowMenubar(URLStr, title, left, top, width, height,id)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, title, 'toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollBars=no,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


function popUpWindow_scroll(URLStr, title, left, top, width, height,id)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, title, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollBars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popUpWindowAll(URLStr, title, left, top, width, height,id)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, title, 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollBars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


	
	
function cNum(e) {
	var strCheck = '0123456789\b\t	 ';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode == 0 || whichCode == 13)
	{
		return true ;		
	}
	key = String.fromCharCode(whichCode);  // Get key value from key code
	if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
}

function cNumPhone(e) {
	var strCheck = '0123456789\b\t	 +()[]-';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode == 0 || whichCode == 13)
	{
		return true ;		
	}
	key = String.fromCharCode(whichCode);  // Get key value from key code
	if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
}

function block_click(disp)
{
	var list=document.getElementById(disp);
	var arr=document.getElementById("main").getElementsByTagName("div");
	if(list.style.display!="block")
	{
		for(i=0;i<arr.length;i++)
		{
			arr[i].style.display="none";
		}
			list.style.display="block";
	}
	else
	{
		list.style.display="none";
	}
}

// ==========================================================================
// Fuctions to mimic LTrim, RTrim, and Trim...

// Author          Aurélien Tisné(CS)
// Date            03 avr. 2003 23:11:39
// Last Update     $Date$
// Version         $Revision$
// ==========================================================================

// --------------------------------------------------------------------------
// Remove leading blanks from our string.

// I               str - the string we want to LTrim
// Return          the input string without any leading whitespace

// Date            03 avr. 2003 23:12:13
// Author          Aurélien Tisné(CS)
// --------------------------------------------------------------------------
function LTrim(str)
{
  var whitespace = new String(" \t\n\r");

  var s = new String(str);

  if (whitespace.indexOf(s.charAt(0)) != -1) {
    // We have a string with leading blank(s)...

    var j=0, i = s.length;

    // Iterate from the far left of string until we
    // don't have any more whitespace...
    while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
    j++;


    // Get the substring from the first non-whitespace
    // character to the end of the string...
    s = s.substring(j, i);
  }

  return s;
}

// --------------------------------------------------------------------------
// Remove trailing blanks from our string.

// I               str - the string we want to RTrim
// Return          the input string without any trailing whitespace

// Date            03 avr. 2003 23:13:50
// Author          Aurélien Tisné(CS)
// --------------------------------------------------------------------------
function RTrim(str)
{
  // We don't want to trip JUST spaces, but also tabs,
  // line feeds, etc.  Add anything else you want to
  // "trim" here in Whitespace
  var whitespace = new String(" \t\n\r");

  var s = new String(str);

  if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
    // We have a string with trailing blank(s)...

    var i = s.length - 1;       // Get length of string

    // Iterate from the far right of string until we
    // don't have any more whitespace...
    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
      i--;


    // Get the substring from the front of the string to
    // where the last non-whitespace character is...
    s = s.substring(0, i+1);
  }

  return s;
}

function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;

      }

// --------------------------------------------------------------------------
// Remove trailing and leading blanks from our string.

// I               str - the string we want to Trim
// Return          the trimmed input string

// Date            03 avr. 2003 23:15:09
// Author          Aurélien Tisné(CS)
// --------------------------------------------------------------------------
function trim(str)
{
  return RTrim(LTrim(str));
}

function change_display_image(class_name,id)
{
	document.getElementById(id.id).className=class_name;
}


function validate_partner_or_weathminder(form_name)
{
	if(ny.validateForm(form_name))
	{
		document.getElementById(form_name).submit();
	}
	else
	{
		return false;
	}
}


function set_check_hidden(val,id)
{
	if(id.checked==true)
	{
		document.getElementById('check_hidden_box').value+=val;
	}
	else
	{
		var str = document.getElementById('check_hidden_box').value;
		str = str.substr(0,str.length-1);
		document.getElementById('check_hidden_box').value=str;
	}
	return;
}

function PopupPic(sPicURL) 
{ 

 window.open(sPicURL, "fgdfg", "resizable=1,HEIGHT=150,WIDTH=275,top=300,left=400");
}

function imagePOP(sPicURL,width,heigth) 
{ 
 
 window.open(sPicURL, "fgdfg", "resizable=0,HEIGHT="+heigth+",WIDTH="+width+",top=300,left=400");
}

function div_show(id)
{
	document.getElementById(id).style.display='block';
}