
function NewWindow(mypage,myname,w,h,scroll){ 
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=no';
	  settings +='directories=no';
	  settings +='titlebar=no';
	  settings +='toolbar=no';
	  settings +='location=no';
	  settings +='menubar=no';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

function NewWindowTop(mypage,myname,w,h,scroll){ 
  var winl = (screen.width-w)/2;
  var wint = 0;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=no';
	  settings +='directories=no';
	  settings +='titlebar=no';
	  settings +='toolbar=no';
	  settings +='location=no';
	  settings +='menubar=no';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}


function NewWindowTopLeft(mypage,myname,w,h,left,scroll){ 
  var winl = left;
  var wint = 0;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=no';
	  settings +='directories=no';
	  settings +='titlebar=no';
	  settings +='toolbar=no';
	  settings +='location=no';
	  settings +='menubar=no';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

function number_check(f) {
	if (f==13) {
		event.returnValue=true;
	}
	else if ((f<48) || (f>57)) {
		event.returnValue=false;
	}
}



function isEmpty( data ){
    for ( var i = 0 ; i < data.length ; i++ ){
        if ( data.substring( i, i+1 ) != " " )
            return false;
    }
    return true;
}


function getCookie( name )
{

	var nameOfCookie = name + "=";
	var x = 0;
	while ( x <= document.cookie.length )
	{
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
				endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 )
			break;
	}
	return "";
}


function setCookie( name, value, expiredays )
{
    var today = new Date();
    today.setHours( today.getHours(),  + expiredays );
    document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";";
}

function delCookie (name) {  
        var exp = new Date();  
        exp.setTime (exp.getTime() - 1);  
        var cval = getCookie (name);  
        document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function calbyte(aquery) {

	var tmpStr;
	var temp=0;
	var onechar;
	var tcount;
	tcount = 0;
		 
	tmpStr = new String(aquery);
	temp = tmpStr.length;

	for (k=0;k<temp;k++) {
		onechar = tmpStr.charAt(k);
		onechar_1 = escape(onechar);
		if ( onechar_1.charAt(0) == "%" ) {
			onechar_1 = onechar_1.substring(1,2);
			switch ( onechar_1 ) {
			case "0":
			case "1":
			case "2":
			case "3":
			case "4":
			case "5":
			case "6":
			case "7":
				tcount++;
				break;
			default:
				tcount += 2;
				break;
			}
		}
		else if (onechar!='\r') {
			tcount++;
		}
	}
	return tcount;
}


function loadFlash(filename,width,height,oMenu,oWmode)
{	
	
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ width +'" height="'+ height +'">'); 
	document.write('<param name="movie" value="'+ filename +'"><param name="quality" value="high">');

	if(oMenu)
		document.write('<param name="menu" value="false">');
	if(oWmode)
	{
		document.write('<param name="wmode" value="transparent">'); 
		document.write('<embed src="'+ filename +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ width +'" height="'+ height +'" wmode=transparent></embed></object>');
	}
}
  
  
   
// -------------------------------------------------------------------
// MM_reloadPage(init)
// -------------------------------------------------------------------   
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}    
