function maximizare_fereastra() {
	window.moveTo(0,0)
	window.resizeTo(screen.width,screen.height)
}

function myalert(x) {
	x	=	x.replace( /&acirc;/g, String.fromCharCode( 226 ) );
	x	=	x.replace( /&Acirc;/g, String.fromCharCode( 194 ) );
	x	=	x.replace( /&icirc;/g, String.fromCharCode( 238 ) );
	x	=	x.replace( /&Icirc;/g, String.fromCharCode( 206 ) );
	x	=	x.replace( /&#259;/g, String.fromCharCode( 259 ) );
	x	=	x.replace( /&#258;/g, String.fromCharCode( 258 ) );
	x	=	x.replace( /&#238;/g, String.fromCharCode( 238 ) );
	x	=	x.replace( /&#237;/g, String.fromCharCode( 237 ) );
	x	=	x.replace( /&#351;/g, String.fromCharCode( 351 ) );
	x	=	x.replace( /&#350;/g, String.fromCharCode( 350 ) );
	x	=	x.replace( /&#355;/g, String.fromCharCode( 355 ) );
	x	=	x.replace( /&#354;/g, String.fromCharCode( 354 ) );
	alert( x );
}

function myconfirm(x) {
	x	=	x.replace( /&acirc;/g, String.fromCharCode( 226 ) );
	x	=	x.replace( /&Acirc;/g, String.fromCharCode( 194 ) );
	x	=	x.replace( /&icirc;/g, String.fromCharCode( 238 ) );
	x	=	x.replace( /&Icirc;/g, String.fromCharCode( 206 ) );
	x	=	x.replace( /&#259;/g, String.fromCharCode( 259 ) );
	x	=	x.replace( /&#258;/g, String.fromCharCode( 258 ) );
	x	=	x.replace( /&#238;/g, String.fromCharCode( 238 ) );
	x	=	x.replace( /&#237;/g, String.fromCharCode( 237 ) );
	x	=	x.replace( /&#351;/g, String.fromCharCode( 351 ) );
	x	=	x.replace( /&#350;/g, String.fromCharCode( 350 ) );
	x	=	x.replace( /&#355;/g, String.fromCharCode( 355 ) );
	x	=	x.replace( /&#354;/g, String.fromCharCode( 354 ) );
	r = confirm (x) ;
	return r ;
}

function checkemail(id) {
	var testresults ;
	var str = $(id).value ;
	var filter=/^.+@.+\..{2,3}$/ ;
	
	if (filter.test(str))
		return true ;
	else		
		return false ;	
}

function findPosX(obj) {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) {
          	curleft += obj.offsetLeft;
          	if(!obj.offsetParent)
            	break;
          	obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
}

function findPosY(obj) {
    var curtop = 0;
    if(obj.offsetParent)
        while(1) {
          	curtop += obj.offsetTop;
          	if(!obj.offsetParent)
            	break;
          	obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
}

//	sterge spatiile de la inceput
function LTrim(value) {
	var re = /\s*((\S+\s*)*)/ ;
	return value.replace(re, "$1") ;
}

//	sterge spatiile de la sfarsit
function RTrim(value) {
	var re = /((\s*\S+)*)\s*/ ;
	return value.replace(re, "$1") ;
}

//	sterge spatiile de la inceput si de la sfarsit
function trim(value) {
	return LTrim(RTrim(value)) ;	
}

function rest(x, y) {//restul impartirii lui x la y
	if (y == 0)
		myalert("Valoarea &icirc;mp&#259;r&#355;itorului trebuie s&#259; fie diferit&#259; de 0 !!!")
	else
		restul = x/y - Math.floor(x/y) 
	return restul
}

// Crearea unui cookie si atribuirea acesteia unei valori
function setCookie(c_name,value,expiredays) {
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + expiredays);
	var string = "" ;
	string += c_name ;
	string += escape(value) ;
	string += (expiredays==null) ? "" : ";expires=" ;
	string += exdate.toGMTString() ;
	document.cookie = string ; 
}

// Stergerea unui cookie
function unsetCookie(c_name) {
	//var x = getCookie(c_name) ;
	//if (x) 
		setCookie(c_name,'',-1) ;
}



// Verifica daca a fost creata o anumita variabila cookie si returneaza valoarea acesteia
function getCookie(c_name) {
	if (document.cookie.length > 0) {
		c_start = document.cookie.indexOf(c_name + "=");
		if (c_start != -1) { 
			c_start = c_start + c_name.length + 1; 
			c_end = document.cookie.indexOf(";",c_start);
			if (c_end == -1)
				c_end = document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return "";
}

///////////////////////////////////////////////////////////////////////////////////////////////////
//	USED FOR GETTING THE COMPUTED WIDTH OF AN ELEMENT IN PIXELS
//	el - Object
//	includePadding - boolean
//	includeBorder - boolean
///////////////////////////////////////////////////////////////////////////////////////////////////
function getWidth(el, includePadding, includeBorder) {
    var width;
    el = (typeof(el) === "string") ? document.getElementById(el) : el;	
    
    if (window.getComputedStyle) { // FF, Safari, Opera
        var style = document.defaultView.getComputedStyle(el, null);
        if (style.getPropertyValue("display") === "none")
            return 0;
        width = parseInt(style.getPropertyValue("width"));
        
        if (/opera/i.test(navigator.userAgent)) {
            // opera includes the padding and border when reporting the width/height - subtract that out
            width -= parseInt(style.getPropertyValue("padding-left"));
            width -= parseInt(style.getPropertyValue("padding-right"));
            width -= parseInt(style.getPropertyValue("border-left-width"));
            width -= parseInt(style.getPropertyValue("border-right-width"));
        }
        
        if (includePadding) {
            width += parseInt(style.getPropertyValue("padding-left"));
            width += parseInt(style.getPropertyValue("padding-right"));
        }
        
        if (includeBorder) {
            width += parseInt(style.getPropertyValue("border-left-width"));
            width += parseInt(style.getPropertyValue("border-right-width"));
        }
    } else { // IE
        if (el.currentStyle["display"] === "none")
            return 0;
        var bRegex = /thin|medium|thick/; // regex for css border width keywords
        width = el.offsetWidth; // currently the width including padding + border
        
        if (!includeBorder) {
            var borderLeftCSS = el.currentStyle["borderLeftWidth"];
            var borderRightCSS = el.currentStyle["borderRightWidth"];
            var temp = document.createElement("DIV");
            if (el.offsetWidth > el.clientWidth && el.currentStyle["borderLeftStyle"] !== "none") {
                if (!bRegex.test(borderLeftCSS)) {
                    temp.style.width = borderLeftCSS;
                    el.parentNode.appendChild(temp);
                    width -= Math.round(temp.offsetWidth);
                    el.parentNode.removeChild(temp);
                } else if (bRegex.test(borderLeftCSS)) {
                    temp.style.width = "10px";
                    temp.style.border = borderLeftCSS + " " + el.currentStyle["borderLeftStyle"] + " #000000";
                    el.parentNode.appendChild(temp);
                    width -= Math.round((temp.offsetWidth-10)/2);
                    el.parentNode.removeChild(temp);
                }
            }
            if (el.offsetWidth > el.clientWidth && el.currentStyle["borderRightStyle"] !== "none") {
                if (!bRegex.test(borderRightCSS)) {
                    temp.style.width = borderRightCSS;
                    el.parentNode.appendChild(temp);
                    width -= Math.round(temp.offsetWidth);
                    el.parentNode.removeChild(temp);
                } else if (bRegex.test(borderRightCSS)) {
                    temp.style.width = "10px";
                    temp.style.border = borderRightCSS + " " + el.currentStyle["borderRightStyle"] + " #000000";
                    el.parentNode.appendChild(temp);
                    width -= Math.round((temp.offsetWidth-10)/2);
                    el.parentNode.removeChild(temp);
                }
            }
        }
        
        if (!includePadding) {
            var paddingLeftCSS = el.currentStyle["paddingLeft"];
            var paddingRightCSS = el.currentStyle["paddingRight"];
            var temp = document.createElement("DIV");
            temp.style.width = paddingLeftCSS;
            el.parentNode.appendChild(temp);
            width -= Math.round(temp.offsetWidth);
            temp.style.width = paddingRightCSS;
            width -= Math.round(temp.offsetWidth);
            el.parentNode.removeChild(temp);
        }
    }
    
    return width;
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// 	USED FOR GETTING THE COMPUTED HEIGHT OF AN ELEMENT IN PIXELS
//	el - Object
//	includePadding - boolean
//	includeBorder - boolean
///////////////////////////////////////////////////////////////////////////////////////////////////
function getHeight(el, includePadding, includeBorder) {
    var height;
    el = (typeof(el) === "string") ? document.getElementById(el) : el;
    
    if (window.getComputedStyle) { // FF, Safari, Opera
        var style = document.defaultView.getComputedStyle(el, null);
        if (style.getPropertyValue("display") === "none")
            return 0;
        height = parseInt(style.getPropertyValue("height"));
        
        if (/opera/i.test(navigator.userAgent)) {
            // opera includes the padding and border when reporting the width/height - subtract that out
            height -= parseInt(style.getPropertyValue("padding-top"));
            height -= parseInt(style.getPropertyValue("padding-bottom"));
            height -= parseInt(style.getPropertyValue("border-top-width"));
            height -= parseInt(style.getPropertyValue("border-bottom-width"));
        }
        
        if (includePadding) {
            height += parseInt(style.getPropertyValue("padding-top"));
            height += parseInt(style.getPropertyValue("padding-bottom"));
        }
        
        if (includeBorder) {
            height += parseInt(style.getPropertyValue("border-top-width"));
            height += parseInt(style.getPropertyValue("border-bottom-width"));
        }
    } else { // IE
        if (el.currentStyle["display"] === "none")
            return 0;
        var bRegex = /thin|medium|thick/; // regex for css border width keywords
        height = el.offsetHeight; // currently the height including padding + border
    
        if (!includeBorder) {
            var borderTopCSS = el.currentStyle["borderTopWidth"];
            var borderBottomCSS = el.currentStyle["borderBottomWidth"];
            var temp = document.createElement("DIV");
            if (el.offsetHeight > el.clientHeight && el.currentStyle["borderTopStyle"] !== "none") {
                if (!bRegex.test(borderTopCSS)) {
                    temp.style.width = borderTopCSS;
                    el.parentNode.appendChild(temp);
                    height -= Math.round(temp.offsetWidth);
                    el.parentNode.removeChild(temp);
                } else if (bRegex.test(borderTopCSS)) {
                    temp.style.width = "10px";
                    temp.style.border = borderTopCSS + " " + el.currentStyle["borderTopStyle"] + " #000000";
                    el.parentNode.appendChild(temp);
                    height -= Math.round((temp.offsetWidth-10)/2);
                    el.parentNode.removeChild(temp);
                }
            }
            if (el.offsetHeight > el.clientHeight && el.currentStyle["borderBottomStyle"] !== "none") {
                if (!bRegex.test(borderBottomCSS)) {
                    temp.style.width = borderBottomCSS;
                    el.parentNode.appendChild(temp);
                    height -= Math.round(temp.offsetWidth);
                    el.parentNode.removeChild(temp);
                } else if (bRegex.test(borderBottomCSS)) {
                    temp.style.width = "10px";
                    temp.style.border = borderBottomCSS + " " + el.currentStyle["borderBottomStyle"] + " #000000";
                    el.parentNode.appendChild(temp);
                    height -= Math.round((temp.offsetWidth-10)/2);
                    el.parentNode.removeChild(temp);
                }
            }
        }
    
        if (!includePadding) {
            var paddingTopCSS = el.currentStyle["paddingTop"];
            var paddingBottomCSS = el.currentStyle["paddingBottom"];
            var temp = document.createElement("DIV");
            temp.style.width = paddingTopCSS;
            el.parentNode.appendChild(temp);
            height -= Math.round(temp.offsetWidth);
            temp.style.width = paddingBottomCSS;
            height -= Math.round(temp.offsetWidth);
            el.parentNode.removeChild(temp);
        }
    }
    
    return height;
}

function select_current_date(zi, luna, an) {
	
	var current_date = new Date() ;
	
	var year = current_date.getYear() ;	    
	var month = current_date.getMonth() ;    
	var today = current_date.getDate() ;    
	
	$(zi).selectedIndex = today - 1 ;	
	$(luna).selectedIndex = month ;
	
	j = 0 ;
	for (i = 2006; i < 2037; i++) {
		if (i == year)
			break
		else
			j++ 
	}
	
	
	$(an).selectedIndex = j;
}
