function FirstFocus()
{
    //trim function trebuie
    text_de_cautat=document.getElementById('ctl00_TextToSearch').value.replace(/^\s+|\s+$/g,"");
    if(text_de_cautat=="Cauta")
    {
        document.getElementById('ctl00_TextToSearch').value="";
    }
}        
function OnBlure()
{
    //trim function trebuie
    text_de_cautat=document.getElementById('ctl00_TextToSearch').value.replace(/^\s+|\s+$/g,"");
    if(text_de_cautat=="")
    {
        document.getElementById('ctl00_TextToSearch').value="Cauta";
    }
}
function SearchKeyPress(event)
{   
    if(event.keyCode==13)   
    {
        //daca am apasat enter atunci aplic cautarea   
        text_de_cautat_trim=document.getElementById('ctl00_TextToSearch').value.replace(/^\s+|\s+$/g,"");
        text_de_cautat=text_de_cautat_trim.replace(/ /gi,"+");  //inlocuiesc spatiile cu +
                      
        event.returnValue=false; 
        event.cancel = true;  
		window.open('/Search.aspx?ksearch=' + text_de_cautat, '_blank');
        //window.location.href = "/Search.aspx?ksearch="+text_de_cautat;
        return false;                           
    }
}

function SearchKeyPressEn(event)
{   
    if(event.keyCode==13)   
    {
        //daca am apasat enter atunci aplic cautarea   
        text_de_cautat_trim=document.getElementById('ctl00_TextToSearch').value.replace(/^\s+|\s+$/g,"");
        text_de_cautat=text_de_cautat_trim.replace(/ /gi,"+");  //inlocuiesc spatiile cu +
                      
        event.returnValue=false; 
        event.cancel = true;  
		window.open('/en/Search.aspx?ksearch=' + text_de_cautat, '_blank');
        //window.location.href = "/en/Search.aspx?ksearch="+text_de_cautat;
        return false;                           
    }
}

function divizii_over(old_src_img,new_img)
{        
    var new_src=old_src_img.src.substring(0,old_src_img.src.lastIndexOf("/"));
    new_src+="/"+new_img;                
    old_src_img.src=new_src;        
}

function adaugaBookmark(event)
{
    
    event.returnValue=false; 
    event.cancel = true;                          
    var titlu= unescape(document.title);
    var url=location.href;        
     
    if (window.sidebar) // firefox 
    {                
        window.sidebar.addPanel(titlu, url, ""); 
    }
    else if(window.opera && window.print) // opera 
    {
        //pentru opera 10 nu merge asta
        var elem = document.createElement('a'); 
        elem.setAttribute('href',url); 
        elem.setAttribute('title',titlu); 
        elem.setAttribute('rel','sidebar'); 
        elem.click();
    } 
    else if(document.all)// ie 
    {             
        window.external.AddFavorite(url, titlu); 
    }
    else
        alert('Aceasta functie nu este suportata de  browser-ul domneavoastra. Apasati CTRL+D pentru a face bookmark manual.');              
}    

function trimitePeEmail()
{
    var url=location.href;    
    //testwindow= window.open ("/TrimitePeMail.aspx?loc="+url, "TrimitePeMail","'left=20, top=20, width=730, height=510, resizable=0, menubar=0");    
    
    var form = document.createElement("form"); 
    form.setAttribute("method", "post"); 
    form.setAttribute("action", "/TrimitePeMail.aspx");
    
    var hiddenField = document.createElement("input"); 
    hiddenField.setAttribute("type", "hidden"); 
    hiddenField.setAttribute("name", "fromUrl"); 
    hiddenField.setAttribute("value", url); 
    
    form.appendChild(hiddenField); 
 
    document.body.appendChild(form);
    form.submit(); 
}    

function printVersion()
{
    var url=location.href;    
    //continutul ce se gaseste in diviziunea 'continutAndPrint' se va afisa efectiv pentru printare
    var continutPrint=document.getElementById('continutAndPrint').innerHTML;
    
    var form = document.createElement("form");
    form.setAttribute("method", "post");
    form.setAttribute("action", "/PrintVersion.aspx");
    
    var hiddenField = document.createElement("input"); 
    hiddenField.setAttribute("type", "hidden"); 
    hiddenField.setAttribute("name", "fromUrl"); 
    hiddenField.setAttribute("value", url);
    form.appendChild(hiddenField); 
    
    var hiddenField = document.createElement("input"); 
    hiddenField.setAttribute("type", "hidden"); 
    hiddenField.setAttribute("name", "printContent"); 
    hiddenField.setAttribute("value", continutPrint);   
    form.appendChild(hiddenField); 
 
    document.body.appendChild(form);
    form.submit(); 
}
