function popup(a,b,c, windowName, options) {
    var en = (b == 0) ? 300 : ((b < 200) ? 200 : ((b > 1000) ? 1000 : b));
    var boy = (c == 0) ? 400 : ((c < 200) ? 200 : ((c > 1000) ? 1000 : c));

	var w='_blank';

	if (windowName != null)
       w=windowName;
	
	if (options == null)
		options = "left=30,top=30,scrollbars=yes,resizable=yes,status=no,menubar=yes,toolbar=no,location=no";
	   
    var yeni=window.open(a, w, options+",width="+en+",height="+boy);

   if(navigator.appName == "Microsoft Internet Explorer" &&
       parseInt(navigator.appVersion) >= 4) {
       yeni.focus();
   } else {
      if(navigator.appName != "Microsoft Internet Explorer")
      yeni.focus(); }
}


/*
==================================================================
Browser Version
==================================================================
*/
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
	var agt = navigator.userAgent.toLowerCase();
	
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);

    // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
    // If you want to allow spoofing, take out the tests for opera and webtv.
    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    var is_nav2 = (is_nav && (is_major == 2));
    var is_nav3 = (is_nav && (is_major == 3));
    var is_nav4 = (is_nav && (is_major == 4));
    var is_nav4up = (is_nav && (is_major >= 4));
    var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                          (agt.indexOf("; nav") != -1)) );
    var is_nav6 = (is_nav && (is_major == 5));
    var is_nav6up = (is_nav && (is_major >= 5));
    var is_gecko = (agt.indexOf('gecko') != -1);


    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie4up  = (is_ie && (is_major >= 4));
    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
//------------------------------------------------------------------



/*
==================================================================
Printing functions
==================================================================
*/
function showElem(o) {
	if (o!=null)
		o.style.display='';
}
function hideElem(o) {
	if (o!=null)
		o.style.display='none';
}

/*
==================================================================
Validation functions
==================================================================
*/
var defaultEmptyOK = false;
var decimalPointDelimiter = ".";

// Returns true if character c is a digit 
// (0 .. 9).
function isDigit (c) {  
	return ((c >= "0") && (c <= "9"))
}

// Check whether string s is empty.
function utIsEmpty(s) {   
	return ((s == null) || (s.length == 0))
}

// utIsFloat (STRING s [, BOOLEAN emptyOK])
// 
// True if string s is an unsigned floating point (real) number. 
//
// Also returns true for unsigned integers. If you wish
// to distinguish between integers and floating point numbers,
// first call isInteger, then call isFloat.
//
// Does not accept exponential notation.
function utIsFloat (s)  {
	var i;
    var seenDecimalPoint = false;

    if (utIsEmpty(s)) 
       if (utIsFloat.arguments.length == 1) 
	   	   return defaultEmptyOK;
       else 
	   	   return (utIsFloat.arguments[1] == true);

    if (s == decimalPointDelimiter) return false;

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++) {   
        // Check that current character is number.
        var c = s.charAt(i);
		
		if ( (c=='-' || c=='+') && i == 0)
			; //Sign is ok
        else if ((c == decimalPointDelimiter) && !seenDecimalPoint) 
			seenDecimalPoint = true;
        else if (!isDigit(c)) 
			return false;
    }

    // All characters are numbers.
    return true;
}

// utIsInteger (STRING s [, BOOLEAN emptyOK])
// 
// True if string s is an integer number. 
function utIsInteger (s)  {
	var i;

    if (utIsEmpty(s)) 
       if (utIsInteger.arguments.length == 1) 
	   	   return defaultEmptyOK;
       else 
	   	   return (utIsInteger.arguments[1] == true);

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++) {   
        // Check that current character is number.
        var c = s.charAt(i);
		
		if ( (c=='-' || c=='+') && i == 0)
			; //Sign is ok
        else if (!isDigit(c)) 
			return false;
    }

    // All characters are numbers.
    return true;
}




/*
==================================================================
Visual functions
==================================================================
*/
var glVObj=null;
function blink_Input_Element(o) {
	glVObj = o;
	glVObj.style.backgroundColor = 'gray';
	window.setTimeout("glVObj.style.backgroundColor = '';", 1000);
}


/*
==================================================================
Misc. Math functions
==================================================================
*/
function generateRandomNumber(maxnumber) {
	var generatornum;
	var r;
	generatornum=Math.random();
	var r=Math.round(generatornum*maxnumber);
	return (r);
}



/*
==================================================================
String manipulation functions
==================================================================
*/
function LTrim(str) {
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {
      var j=0, i = s.length;
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;
      s = s.substring(j, i);
   }
   return s;
}

function RTrim(str) {
   var whitespace = new String(" \t\n\r");
   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      var i = s.length - 1;
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;
      s = s.substring(0, i+1);
   }

   return s;
}

function Trim(str) {
   return RTrim(LTrim(str));
}

//----------------------------------------------------------------------------
//ReplaceString function
function replaceString(s, s1, s2) {
	var t = s;
	if (s1=='') {
		return (t);
	}

	var k = t.toUpperCase().indexOf(s1.toUpperCase(), 0);
	var i = 0;
	while (k >= 0 && i < 100) {
		t = t.substring(0, k) + s2 + t.substring(k+s1.length, t.length);

		k = t.toUpperCase().indexOf(s1.toUpperCase(), k+s2.length);
		i++;
	}
	return (t);
}

//------------------------------------------------------------------------------
function utFormatCurrency(n) {
	var num = n;
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
		return(n);
	if (!utIsFloat(num))
		return(n);

	var sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	var cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
		cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + '$' + num + '.' + cents);
}