/* general conversion functions */
	function toInt(string) {
		var val = parseInt(string, 10);
		
		if ( isNaN(val) ) {
			val = 0;
		}
		
		return val;
	}
	
	function toFloat(string) {
		var val = parseFloat(string, 10);
		
		if ( isNaN(val) ) {
			val = 0.0;
		}
		
		return val;
	}

/* url functions */
	function encodeUrl(key, value, useSimpleEncode) {
		var s = '';
		
		if ( typeof value == 'object' ) {
			var sep = '';
			for (var k in value) {
				s += sep  + encodeUrl(key + "[" + k + "]", value[k]);
				sep = '&';
			}
			
		}
		else {
			s += urlencode(key) + '=' + ( useSimpleEncode ? escape(value) : urlencode(value) );
		}
		return s;
	}
	
	/**
	*	Contruieste un url, plecand de la un array. Ignora valoarile din array-ul $ignore
	*/
	function buildUrl(params, ignore, useSimpleEncode) {
		if ( ignore === null || ignore === undefined || ignore == false ) {
			ignore = [];
		}
		
		var url = '';
		var sep = '';
		
		if (params) {
			for (var key in params) {
				if ( !ignore || ignore[key] == null || ignore[key] == undefined ) {
					url += sep + encodeUrl(key, params[key], useSimpleEncode);
					sep = '&';
				}
			}
		}
	
		return url;
	}


/* cross-browser event handling functions */
	var eventHandlers = new Array();

	function attachEventHandler(object, event) {
		if ( object[event] ) {
			var oldHandler = object[event];
			
			// prevent infinite recursion
			object[event] = null;
			
			object['old_' + event + '_handler'] = registerEvent(
				object,
				event,
				oldHandler
			);
		}
		
		object[event] = function(e) {
			handleEvent(this, event, e);
		};
	}
	
	function registerEvent(object, event, handler) {
		if (! object.genericEvents ) {
			object.genericEvents = new Array();
		}
		
		if (! object.genericEvents[event] ) {
			object.genericEvents[event] = new Array();
			attachEventHandler(object, event);
		}
		
		object.genericEvents[event].push(
			{
				'active' : 1,
				'handler' : handler
			}
		);
		
		eventHandlers.push(
			{
				'object' : object,
				'event' : event,
				'index' : object.genericEvents[event].length - 1
			}
		);
		
		return eventHandlers.length - 1;
	}
	
	function unregisterEvent(resource) {
		
		if (! eventHandlers[resource]) {
			return false;
		}
		
		var object = eventHandlers[resource]['object'];
		var event = eventHandlers[resource]['event'];
		var index = eventHandlers[resource]['index'];
		
		if ( !object || !object.genericEvents || !object.genericEvents[event] || !object.genericEvents[event][index] ) {
			return false;
		}
		
		object.genericEvents[event][index].active = 0;
		
		return true;
	}
	
	function handleEvent(object, event, e) {
		if (! object.genericEvents[event] ) {
			return false;
		}
		
		for (i in object.genericEvents[event])
		if ( object.genericEvents[event][i].active ) {
			var currentEvent = object.genericEvents[event][i].handler;
			object.currentEvent = currentEvent;
			object.currentEvent(e, object);
		}
	}
	
	/**	
		@return 0 => click stanga, 1 => click pe rotita, 2 => click dreapta, -1 daca nu s-a apasat nimic
	*/
	function getEventButton(localEvent) {
		try {
			// IE
			if ( event.button ) {
				switch ( event.button ) {
					case 1:
						return 0;
					case 2:
						return 2;
					case 4:
						return 1;
				}
			}
		}
		catch (e) {
			
		}
		
		// Browsers
		if ( localEvent && localEvent.button !== undefined && localEvent.button !== null ) {
			return localEvent.button;
		}
		else {
			return -1;
		}
	}

/* general functions */
	/*
	function openWindow(url, width, height) {
		var maxWidth = clientWidth() - 100;
		var maxHeight = clientHeight() - 50;
		
		if ( height > maxHeight ) {
			height = maxHeight;
		}
		
		if ( width > maxWidth ) {
			width = maxWidth;
		}
		
		showSimplePopup(width, height, url, 'Loading...');
	}
	*/
	
	var windowsOpened = 0;
	function openWindow(url, width, height) {
		windowsOpened++;
		
		var maxWidth = clientWidth() - 100;
		var maxHeight = clientHeight() - 50;
		
		if ( height > maxHeight ) {
			height = maxHeight;
		}
		
		if ( width > maxWidth ) {
			width = maxWidth;
		}
		
		popup = getPopupByUrl(url, 'popup' + windowsOpened);
		popup.setSize(width, height);
		
		popup.transparency = false;
		
		popup.load(url);
		
		popup.show();
	}
	
	function confirmRedirect(url, question) {
		if ( confirm(question) ) {
			window.document.location.href = url;
		}
	}

	function getWidth(elemId) {
		return getObj(elemId).offsetWidth;
	}
	
	function getHeight(elemId) {
		return getObj(elemId).offsetHeight;
	}

	function erase(elemId) {
		getObj(elemId).value = '';
	}
	
	function completeIfNotNull(elemId, value) {
		if (! getObj(elemId).value ) {
			getObj(elemId).value = value;
		}
	}

	
	function hide(id) {
		var obj = getObj(id);
		
		if (! obj ) {
			return false;
		}
		
		obj.style.display = 'none';
	}
	
	function show(id) {
		var obj = getObj(id);
		
		if (! obj ) {
			return false;
		}
		
		obj.style.display = '';
	}

	function findPosX(obj)
	{
		var curleft = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curleft += obj.offsetLeft
				//curleft -= obj.parentNode.scrollLeft;
				obj = obj.offsetParent;
			}
		}
		else if (obj.x)
			curleft += obj.x;
		return curleft;
	}
	
	function findPosY(obj)
	{
		var curtop = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curtop += obj.offsetTop
				//curtop -= obj.parentNode.scrollTop;
				obj = obj.offsetParent;
			}
		}
		else if (obj.y)
			curtop += obj.y;
		return curtop;
	}
	
	
	function move(obj, x, y) {
		obj.style.position = 'absolute';
		obj.style.top = y + 'px';
		obj.style.left = x + 'px';
		obj.style.display = '';
	}
	
	function getObj(elemId) {
		return document.getElementById(elemId);
	}
	
	function clientWidth() {
		return filterResults (
			window.innerWidth ? window.innerWidth : 0,
			document.documentElement ? document.documentElement.clientWidth : 0,
			document.body ? document.body.clientWidth : 0
		);
	}
	
	function clientHeight() {
		return filterResults (
			(window.innerHeight > 100) ? window.innerHeight : 0,
			(document.documentElement > 100) ? ( document.documentElement.clientHeight > 100 ? document.documentElement.clientHeight : 0 ) : 0,
			document.body ? ( document.body.clientHeight > 100 ? document.body.clientHeight : 0 ) : 0
		);
	}
	
	function scrollLeft() {
		return filterResults (
			window.pageXOffset ? window.pageXOffset : 0,
			document.documentElement ? document.documentElement.scrollLeft : 0,
			document.body ? document.body.scrollLeft : 0
		);
	}
	
	function scrollTop() {
		return filterResults (
			window.pageYOffset ? window.pageYOffset : 0,
			document.documentElement ? document.documentElement.scrollTop : 0,
			document.body ? document.body.scrollTop : 0
		);
	}
	
	function filterResults(n_win, n_docel, n_body) {
		var n_result = n_win ? n_win : 0;
		if (n_docel && (!n_result || (n_result > n_docel)))
			n_result = n_docel;
		return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
	}
	
	function urlencode(s) {
		return escape( utf8_encode(s) );
	}
	
	function hideSelect()
	{
		var obj=document.getElementsByTagName("select");
		if((navigator.userAgent.indexOf("MSIE")!=-1) && (navigator.userAgent.indexOf("Opera")==-1))
		{
			for(i=0;i<obj.length;i++)
				obj[i].style.visibility='hidden';
		}
	
	}
	
	function showSelect()
	{
		var obj=document.getElementsByTagName("select");
		if((navigator.userAgent.indexOf("MSIE")!=-1) && (navigator.userAgent.indexOf("Opera")==-1))
		{
			for(i=0;i<obj.length;i++)
				obj[i].style.visibility='visible';
		}
	}


/* change or restore an element's css class*/

	function changeClass(elem, newClass) {
		if (! elem.oldClass ) {
			elem.oldClass = elem.className;
		}
		
		elem.className = newClass;
	}
	
	function restoreClass(elem) {
		elem.className = elem.oldClass;
	}


/* transparency functions */

	var ie = (navigator.appName=="Microsoft Internet Explorer") ? 1 : 0;
	var p = (ie) ? "filter" : "MozOpacity";
	
	function setOpacity(element, opacity) {
		v = (ie) ? "alpha(opacity:"+opacity+")" : opacity/100;
		element.style[p] = v;
		element.style.opacity = v;
	}
	
/* cookies */
	function setCookie(cookieName,cookieValue,nDays) {
		var today = new Date();
		var expire = new Date();
		
		if (nDays==null || nDays==0) nDays=1;
		
		expire.setTime(today.getTime() + 3600000*24*nDays);
		
		document.cookie = cookieName+"="+escape(cookieValue)
	                 + ";expires="+expire.toGMTString();
	}
	
	function getCookie(name) {
	    var dc = document.cookie;
	    var prefix = name + "=";
	    var begin = dc.indexOf("; " + prefix);
	    if (begin == -1) {
	        begin = dc.indexOf(prefix);
	        if (begin != 0) return null;
	    }
	    else {
	        begin += 2;
	    }
	
	    var end = document.cookie.indexOf(";", begin);
	
	    if (end == -1) {
	        end = dc.length;
	    }
	    return unescape(dc.substring(begin + prefix.length, end));
	}
/* expand-collapse */
	var expandStates = new Array();
	function expand(imgId, descId, initialState) {
		if ( expandStates[imgId] === undefined || expandStates[imgId] === null ) {
			expandStates[imgId] = initialState;
			//alert(expandStates[imgId]);
		}
		
		var img = getObj(imgId);
		var desc = getObj(descId);
		
		img.src = expandStates[imgId] ? 'images/expand.jpg' : 'images/collapse.jpg';
		desc.style.display = expandStates[imgId] ? 'none' : '';
		
		expandStates[imgId] = !expandStates[imgId];
	}

/* keys and mouse functions */
	
	/////////////////////////////
	// ctrl, alt, shift states
	/////////////////////////////
	
	var ctrlPressed = 0;
	var altPressed = 0;
	var shiftPressed = 0;
	
	function shiftAltCtrlKeyDown(e) {
		if (parseInt(navigator.appVersion)>3) {
	
			var evt = navigator.appName=="Netscape" ? e:event;
		
			if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)==4) {
				// NETSCAPE 4 CODE
				var mString =(e.modifiers+32).toString(2).substring(3,6);
				shiftPressed=(mString.charAt(0)=="1");
				ctrlPressed =(mString.charAt(1)=="1");
				altPressed  =(mString.charAt(2)=="1");
				//self.status = "modifiers="+e.modifiers+" ("+mString+")";
			}
			else {
				// NEWER BROWSERS [CROSS-PLATFORM]
				shiftPressed=evt.shiftKey;
				altPressed  =evt.altKey;
				ctrlPressed =evt.ctrlKey;
			}
		}
	 	return true;
	}
	
	//registerEvent(document, 'onkeydown', shiftAltCtrlKeyDown);
	//registerEvent(document, 'onkeyup', shiftAltCtrlKeyDown);
	
	
	////////////////////////
	// mouse position
	////////////////////////
	
	// mousePositionorary variables to hold mouse x-y pos.s
	var mousePositionX = 0
	var mousePositionY = 0
	
	// Main function to retrieve mouse x-y pos.s
	
	function getMouseXY(e) {
		if ( document.all ) { // grab the x-y pos.s if browser is IE
			mousePositionX = event.clientX + document.body.scrollLeft;
			mousePositionY = event.clientY + document.body.scrollTop;
		} else {  // grab the x-y pos.s if browser is NS
			mousePositionX = e.pageX;
			mousePositionY = e.pageY;
		}  
		
		// catch possible negative values in NS4
		if ( mousePositionX < 0 ) {
			mousePositionX = 0;
		}
		
		if ( mousePositionY < 0 ) {
			mousePositionY = 0;
		}
		
		return true;
	}
	
	//registerEvent(document, 'onmousemove', getMouseXY);
	
	
	
	function cloneObject(src) {
		if ( typeof(src) != 'object' ) {
			return src;
		}
		
		var _this = new Object();
		
	    for (i in src) {
	        _this[i] = cloneObject(src[i]);
	    }
	    
	    return _this;
	}
	
	var dpWindow = null;
	function dp(a, maxLevels) {
		if ( dpWindow == null ) {
			dpWindow = window.open('about:blank', 'dp', 'width=200,height=500,scrollbars=yes,resizable=yes');
		}
		
		dpWindow.document.write(
			'<pre>'
			+ printObject(
				a, maxLevels
			)
			+ '</pre>'
		);
		
		dpWindow.scrollBy(0, 99999);
	}
	
	function alertObject(a, maxLevels) {
		alert(
			printObject(a, maxLevels)
		);
	}
	
	function printObject(a, maxLevels, level) {
		level = toInt(level);
		
		if (! maxLevels ) {
			maxLevels = 1;
		}
		
		var s = '';
		
		if ( typeof a == 'object' ) {
			if ( a == null ) {
				s += "[null]";
			}
			else if ( a == undefined ) {
				s += "[undefined]";
			}
			else if ( a.__parsedByPrintObject ) {
				s += "[* recursion *]";
			}
			else  {
			
				s += typeof a;
				if ( level < maxLevels ) {
					a.__parsedByPrintObject = true;
					
					s += "\n";
					
					for (var i in a)
					if ( i.indexOf('__parsedByPrintObject') == -1 ) {
						for (var j=0; j<level; j++) {
							s += "  ";
						}
						s += '[' + i + '] = ' + printObject(a[i], maxLevels, level+1) + "\n";
					}
					
					a.__parsedByPrintObject = false;
				}
			}
		}
		else {
			s += a;
		}
		
		return s;
	}
	
	function clip(obj, top, left, width, height) {
		top = toInt(top);
		left = toInt(left);
		right = left + toInt(width);
		bottom = top + toInt(height);
		
		obj.style.clip = "rect(" + top + "px " + right + "px " + bottom + "px " + left + "px)";
		//window.status = obj.style.clip;
	}
	
	function getFlashMovieObject(movieName)
	{
	  if (window.document[movieName]) 
	  {
	      return window.document[movieName];
	  }
	  else if ( document.embeds && document.embeds[movieName] ) {
	      return document.embeds[movieName]; 
	  }
	  else if ( document.getElementById(movieName))  {
	    return document.getElementById(movieName);
	  }
	  else {
	  	return null;
	  }
	}
	
	

	function strip_tags(html) {
		html = html.replace(/<.*?>/ig, '');
		html = html.replace(/\s+/ig, ' ');
		return html;
	}
	
	function htmlspecialchars(html) {
		html = html.replace('/"/ig', '&quot;');
		html = html.replace(/>/ig, '&gt;');
		html = html.replace(/</ig, '&lt;');
		html = html.replace(/&/ig, '&amp;');
		return html;
	}
	
	
    // public method for url encoding
    function utf8_encode(string) {
    	string = string.toString();
    	string = string.replace(/\r\n/g,"\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }

        return utftext;
    }

    // public method for url decoding
    function utf8_decode(utftext) {
    	string = string.toString();
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while ( i < utftext.length ) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }

        }

        return string;
    }
    
    function str_repeat(what, count) {
    	var ret = '';
    	for (var i=0; i<count; i++) {
    		ret += what;
    	}
    	
    	return ret;
    }
    
    function padNumber(number, maxDigits) {
    	var length = number.toString().length;
    	if ( length < maxDigits ) {
    		number = str_repeat('0', maxDigits-length) + number;
    	}
    	
    	return number;

    }
    

    
    function trim(string) {
    	var ret = string.toString();
    	ret = ret.replace(/^\s+/g, '');
    	ret = ret.replace(/\s+$/g, '');
    	return ret;
    }
    
    function buttonSetText(str)
	{
		//dp(this);				
		tags = this.getElementsByTagName("td");
		if(!tags.length)
		{
			return false;
		}
		
		for(var i = 0; i < tags.length; i++)
		{			
			if(!tags[i].getAttribute("name"))
			{
				continue;
			}
			if(tags[i].getAttribute("name") == "text")
			{				
				tags[i].innerHTML = str;	
			}
		}
	}
	
	function buttonSetImage(src)
	{
		var tags = this.getElementsByTagName("img");
		if(tags.length == 0)
		{
			return;
		}
		for(var i = 0; i < tags.length; i++)
		{
			if(!tags[i].getAttribute("name"))
			{
				continue;
			}
			if(tags[i].getAttribute("name") == "image")
			{
				tags[i].src = src;
			}
		}
	}
	
	function setElemAttribute(elem, attribute, value) {
		elem.setAttribute('old_' + attribute, elem['attribute']);
		elem['attribute'] = value;
	}
	
	function restoretElemAttribute(elem, attribute) {
		elem['attribute'] = elem.getAttribute('old_' + attribute);
	}
	
	function setOrRestoreElemAttribute(op, elem, attribute, value) {
		switch ( op ) {
			case 'set':
				setElemAttribute(elem, attribute, value);
				break;
				
			case 'restore':
				restoreElemAttribute(elem, attribute);
				break;
		}
	}
	
	function setEnabled(elem, state) {
		if (! elem ) {
			return false;
		}
		
		for (var i=0; i<elem.childNodes.length; i++) {
			setEnabled(elem.childNodes[i], state);
		}
		
		var currentState = !elem.getAttribute('elemDisabled');
		
		switch ( elem.tagName.toLowerCase() ) {
			case 'input':
				switch ( elem.type.toLowerCase() ) {
					case 'button':
					case 'submit':
						if (! state ) {
							elem.disabled = true;
							
							if ( currentState ) {
								elem.setAttribute('oldColor', elem.style.color);
							}
							
							elem.style.color = '#ccc';
						}
						else {
							elem.disabled = false;
							elem.style.color = elem.getAttribute('oldColor');
						}
						break;
						
					default:
						if (! state ) {
							elem.readOnly = true;
							
							if ( currentState ) {
								elem.setAttribute('oldColor', elem.style.color);
							}
							
							elem.style.color = '#999';
						}
						else {
							elem.readOnly = false;
							elem.style.color = elem.getAttribute('oldColor');
						}
						break;
				}
				break;
		}
		
		elem.setAttribute('elemDisabled', !state);
	}
	
	

function number_format(a, b, c, d) 
{	
	sign = (a < 0) ? "-" : "";
	a = Math.abs(Math.round(a * Math.pow(10, b)) / Math.pow(10, b));
	e = a + '';
	f = e.split('.');
	if (!f[0]) 
	{
		f[0] = '0';
	}
	if (!f[1]) 
	{
		f[1] = '';
	}
	if (f[1].length < b) 
	{
		g = f[1];
		for (i=f[1].length + 1; i <= b; i++) 
		{
			g += '0';
		}
		f[1] = g;
	}
	if(d != '' && f[0].length > 3) 
	{
		h = f[0];
		f[0] = '';
		for(j = 3; j < h.length; j+=3) 
		{
			i = h.slice(h.length - j, h.length - j + 3);
			f[0] = d + i +  f[0] + '';
		}
		j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3));
		f[0] = j + f[0];
	}
	c = (b <= 0) ? '' : c;
	return sign + f[0] + c + f[1];
}

function Browser() {

  var ua, s, i;

  this.isIE    = false;  // Internet Explorer
  this.isNS    = false;  // Netscape
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

function getPageOffsetLeft(el) {

  var x;

  // Return the x coordinate of an element relative to the page.

  x = el.offsetLeft;
  if (el.offsetParent != null)
    x += getPageOffsetLeft(el.offsetParent);

  return x;
}

function getPageOffsetTop(el) {

  var y;

  // Return the x coordinate of an element relative to the page.

  y = el.offsetTop;
  if (el.offsetParent != null)
    y += getPageOffsetTop(el.offsetParent);

  return y;
}

function hideSelects(divId) {

	if (!browser.isIE)
		return false;
	var divObject = document.getElementById(divId);
	if (divObject == null)
		return false;
		
	showSelects();	
 
	var x1 = getPageOffsetLeft(divObject);
	var x2 = x1 + divObject.offsetWidth;
	var y1 = getPageOffsetTop(divObject);
	var y2 = y1 + divObject.offsetHeight;
	  
	var ccx1 = 0;
	var ccx2 = 0;
	var ccy1 = 0;
	var ccy2 = 0;
	
	  
	//we now have the menu div coords
	var tags = new Array("applet", "iframe", "select");
	if (browser.isIE)
	for (var k = tags.length; k > 0; ) {
		var ar = document.getElementsByTagName(tags[--k]);
		var cc = null;
		for (var i = ar.length; i > 0;) {
			cc = ar[--i]; //this is the element we must check
			ccx1 = getPageOffsetLeft(cc);
			ccx2 = ccx1 + cc.offsetWidth;
			ccy1 = getPageOffsetTop(cc);
			ccy2 = ccy1 + cc.offsetHeight;
	
			
			if (
				(
					((ccx1 >= x1)&&(ccx1 <= x2))
					||
					((ccx2 >= x1)&&(ccx2 <= x2))
					||
					((x1 >= ccx1)&&(x1 <= ccx2))
					||
					((x2 >= ccx1)&&(x2 <= ccx2))
				)
				&&
				(
					((ccy1 >= y1)&&(ccy1 <= y2))
					||
					((ccy2 >= y1)&&(ccy2 <= y2))
					||
					((y1 >= ccy1)&&(y1 <= ccy2))
					||
					((y2 >= ccy1)&&(y2 <= ccy2))
				)
			) {
				//alert ('Colision with: '+cc.name);
				cc.style.visibility = "hidden";
				cc.setAttribute('hiddenByF', true);
			}
		}
	}
  return false;
}

function showSelects(){
	var tags = new Array("applet", "iframe", "select");
    var isHidden = false;
    if (browser.isIE)
  	for (var k = tags.length; k > 0; ) {
		var ar = document.getElementsByTagName(tags[--k]);
		var cc = null;
		for (var i = ar.length; i > 0;) {
			cc = ar[--i]; //this is the element we must check
			isHidden = cc.getAttribute('hiddenByF');
			if (isHidden == true) {
				cc.style.visibility = "visible";
				cc.setAttribute('hiddenByF', false);
			}
		}
	}
}

function openFullScreen(url, name)
{
	var width = screen.availWidth;
	var height = screen.availHeight;	
	
	var win = window.open(url, name, 'width=' + width + ', height=' + height + ', top=0, left=0, resizable=yes, scrollbars=yes, status=yes');
		
		//win.moveTo((screen.width - width) / 2, (screen.height - height) / 2);
		//win.resizeTo(width, height);
}

function validateEmail(email) {
	   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	   
	   if(reg.test(trim(email)) == false) {
	      return false;
	   } else 
	   {
		   return true;
	   }
}

function checkEnter(e, form){ 
	//e is event object passed from function invocation
	var characterCode //literal character code will be stored in this variable

	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which //character code is contained in NN4's which property
	}
	else{
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}

	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		form.submit() //submit the form
		return false
	}
	else{
		return true
	}

}
	
	