function PopupPic(sPicURL) 
{
    if(sPicURL.length>0)
    {
        var w = 600;
        var h = 600;
        var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;
        var winprops ='height=600 ,width=600,top='+300+',left='+100+'resizable=true'       
        window.open("/popups/vizualizareFotografie.html?"+sPicURL, "", winprops);     
    }                     
}

function focusOn(elem)
{
	elem.style.backgroundColor = '#ffffff';
	elem.style.border='1px #01476F solid';
}

function focusOff(elem)
{
	elem.style.backgroundColor = '#ffffff';
	elem.style.border='1px #BEDCE9 solid';
}

function setFocus(elem)
{
	document.getElementById(elem).focus();
}

function FCKValue(id)
{
    var temp = document.createElement('txBuffer');
    temp.value = FCKeditorAPI.GetInstance(id).GetXHTML();
    return temp;
}

function $() {
        
	if (arguments.length>1) {
		return false;
	}
	if (arguments.length<1) {
		return false;
	}

	var element = arguments[0];

    if (typeof element == 'string') {
        if (document.getElementById) 
        {
            try 
            {
                element = FCKValue(element);
            }
            catch(err)
            {
                element = document.getElementById(element);            
            }

        } else if (document.all) {
            element = document.all[element];
        }
    }
    
	
	return element;
}

// JavaScript File
function SendSubscriber()
{
    var txEmail = document.getElementById("SubscribeCtrl_txSubscribeEmail").value;  
    var error = "";
        
    if (isNotEmpty(txEmail))
    {
        if (isNotEmpty(txEmail) && !isEmail(txEmail))
        {
            //error += getJSPH("Contact_EmailValid");
            error += getJSPH("Contact_EmailValid");
        }        
    }
    else
    {
        //error += getJSPH("Contact_CompletatiEmail");
        error += getJSPH("Contact_EmailValid");
    }
        
    if (error.length > 0) 
    {
        //error = getJSPH("Contact_RemediatiProblemele") + error;
        error = getJSPH("Contact_RemediatiProblemele") + error;
        alert(error);
    }
    else
    {
        document.location.href='/confirmareInscriere.aspx?sEmail='+txEmail;
    }
}

function isNotEmpty(val)
{
  return ((trim(val)).length>0);
}

function isEmail(val)
{
    if (!isNotEmpty(val)) {
        return true;
    }
	else {
	    var m = val.match(/\w+[.]?\w*@\w+[.]\w+/g);
	    return ((m!=null)&&(m.length>0));
	}
}

function isValidPhoneChar(c)
{
	if((c == "0")||(c == "1")||(c == "2")||(c == "3")||(c == "4")) return true;
	if((c == "5")||(c == "6")||(c == "7")||(c == "8")||(c == "9")) return true;
	if((c == '/')||(c == '-')||(c == '+')) return true;
	if((c == '(')||(c == ')')||(c == ' ')) return true;
	return false;
}

function isPhoneValid(value)
{
	var i=0;
	var s = new String();
	var c='';
	s = value.toString()
	for(i=0;i<s.length;i++)
	{
		c = s.substring(i,i+1);
		if(!isValidPhoneChar(c))
		{
			return false;
		}
	}
	return true;
}

function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function goToHome()
{
    document.location.href = "Default.aspx";
}

function changeLanguage( lang )
{
    if($("Header_hLang")!=lang)
    {   
        $("TopMenu_hLang").value = lang;
        $("frmMain").submit();
    }   
}



