function change(id)
         {
         o=document.getElementById(id);
         o.style.top=o.offsetTop-45+"px";
         }
function copyValue(id,strValue)
		{
			document.getElementById(id).value = strValue;
		}
function bigpic(desc1,alt1,name1)
        {
        o=document.getElementById('bigpic');
		o.innerHTML="<center><img src=\"thumbs.php?img=imagini/portofoliu/galerii/companii/"+name1+"&w=300\" alt='"+alt1+"' /></center>";
	    o=document.getElementById('description');
	    o.innerHTML=desc1;
		}
function bigpic_house(desc2,alt2,name2)
        {
        o=document.getElementById('bigpic');
		o.innerHTML="<center><img src=\"thumbs.php?img=imagini/portofoliu/galerii/locuinte/"+name2+"&w=300\" alt='"+alt2+"' /></center>";
	    o=document.getElementById('description');
	    o.innerHTML=desc2;
		}
function bigpic_media(desc2,alt2,name2)
        {
        o=document.getElementById('bigpic');
		o.innerHTML="<center><img src=\"thumbs.php?img=imagini/media/galerii/"+name2+"&w=300\" alt='"+alt2+"' /></center>";
	    o=document.getElementById('description');
	    o.innerHTML=desc2;
		}
function swith(id1)
        {
	    o=document.getElementById('edit_area');
		o.innerHTML="<iframe src=portofoliu.php?action=editare_pic&id="+id1+" width='700' height='600' frameborder='0'></iframe>";
		}
function swith_house(id2)
        {
	    o=document.getElementById('edit_area');
		o.innerHTML="<iframe src=portofoliu.php?action=editare_house_pic&id="+id2+" width='700' height='600' frameborder='0'></iframe>";
		}
function swith_house(id2)
        {
	    o=document.getElementById('edit_area');
		o.innerHTML="<iframe src=mass_media.php?action=editare_media_pic&id="+id2+" width='700' height='600' frameborder='0'></iframe>";
		}
function move(id,nr)
       {
       o=document.getElementById(id);
       o.style.top=o.offsetTop+nr+"px";
       }
function resetbt(id)
       {
       o=document.getElementById(id);
	   switch(id)
             {
             case 'portofoliuimg':
                o.style.top="0px";
                break;    
             case 'mediaimg':
                o.style.top="-180px";
                break;
             case 'serviciiimg':
                o.style.top="-360px";
                break;
             case 'despreimg':
                o.style.top="-540px";
                break;
             case 'cariereimg':
                o.style.top="-720px";
                break;
             case 'contactimg':
                o.style.top="-900px";
                break;
             }
	   }
function destroy(id)
       {
       obj = document.getElementById(id);
	   Effect.toggle(id,'appear');
       setTimeout("document.body.removeChild(obj);",2000);
       }
function create(msg,type,url)
        {
		 var productElement = document.getElementById("warn");
            if (productElement != null)
               {
               obj = document.getElementById("warn");
               document.body.removeChild(obj);
               }
		 l=Math.round((document.documentElement.clientWidth/2)-(320/2));
		 if (window.pageYOffset==null)
		    {
		    t=Math.round(document.documentElement.clientHeight/2)-Math.round(165/2)+document.documentElement.scrollTop;
			}
		 else
		    {
		    t=Math.round((document.documentElement.clientHeight/2)-(320/2)+window.pageYOffset);
			}
		 this.warn = document.createElement("div"); 
         this.warn.setAttribute("id","warn");
         this.warn.style.zIndex=50;
         this.warn.style.backgroundImage="url(imagini/pics/warning.png)";
		 this.warn.style.position="absolute";
		 this.warn.style.top=t+"px";
		 this.warn.style.left=l+"px";
		 this.warn.style.display="none";
		 this.warn.style.width="320px";
		 this.warn.style.height="165px";
		 if (type=="confirm")
		    {
		    this.warn.innerHTML="<div style='position:absolute;top:70px; left:30px; font-family:Arial;font-size:12px;color:#ffffff; width:150px; height:100px; overflow:hidden;'>"+msg+"<br /><br /></div><center><input type='button' style='border:none; background-image:url(imagini/pics/ok_button.png);position:relative;top:110px;background-color:transparent; width:41px; height:27px;'  onclick=\"window.location='"+url+"'\" align='center' /><input type='button' style='border:none; background-image:url(imagini/pics/cancel_button.png);position:relative;top:110px;background-color:transparent; width:61px; height:27px;'  onclick=\"destroy('warn');\" align='center' /></center>";
			}
		 else if (type=="alert")
		       {
		       this.warn.innerHTML="<div style='position:absolute;top:70px; left:30px; font-family:Arial;font-size:12px;color:#ffffff; width:150px; height:100px; overflow:hidden;'>"+msg+"<br /><br /></div><center><input type='button' style='border:none; background-image:url(imagini/pics/ok_button.png);position:relative;top:110px;background-color:transparent; width:41px; height:27px;'  onclick=\"destroy('warn');\" align='center' /></center>";
			   }
		 createin=document.getElementsByTagName('body')[0];
		 createin.appendChild(this.warn);
		 Effect.toggle('warn','appear');
		}
function validateform(id)
         {
         o=document.getElementById(id);
         if (o.value=="")
            {
            create("Va rugam sa introduceti o adresa valida!","alert","");
            ob1=0;
            }
         else
            {
            ob1=1;
            }
         if (o.value!="")
		    {
		    if ((o.value.indexOf('@')==-1)||(o.value.indexOf('.',o.value.indexOf('@'))==-1))
               {
               create("Va rugam sa introduceti o adresa valida!","alert","");
               ob2=0;	 
               }
            else
               {
               ob2=1;
               }
	   		}
         if ((ob1==1)&&(ob2==1))
            {
            document.newsletter.submit();
            }
         }
function isphone(str)
        {
   	    regex="^([0-9])";
	    if(str.match(regex)) return true;
        return false;
	   }
function validateform1(id1,id2,id3,id4)
        {
        o=document.getElementById(id1);
        if (o.value == "")
         {
          ob1=0;
         }
        else
         {
          ob1=1;
         }
        o=document.getElementById(id2);
        if (o.value=="")
         {
          ob2=0;
         }
        else
         {
          ob2=1;
         }
        if ((o.value.indexOf('@')==-1)||(o.value.indexOf('.',o.value.indexOf('@'))==-1))
         {
          ob5=0;	 
         }
        else
         {
          ob5=1;
         }
        o=document.getElementById(id4);
        if (o.value=="")
         {
          ob4=0;
         }
        else
         {
          ob4=1;
         }
        if ((ob1==1)&&(ob2==1)&&(ob4==1)&&(ob5==1))
         {
          document.contact.submit();	 
         }
		else
		 {
		  if (ob1==0)
		     {
			 create("Trebuie sa introduceti un nume!","alert","");
			 }
		 else if (ob2==0)
		     {
			 create("Trebuie sa introduceti o adresa de mail!","alert","");
			 }
		 else if (ob5==0)
		     {
			 create("Adresa de mail introdusa nu este valida.","alert","");
			 }
		 else if (ob4==0)
		     {
			 create("Trebuie sa introduceti un mesaj!","alert","");
			 }
		 }
}
function ajaxFunction(param1,param2)
        {
        var xmlHttp;
        try
          {
          // Firefox, Opera 8.0+, Safari
          xmlHttp=new XMLHttpRequest();
          }
        catch (e)
          {
          // Internet Explorer
          try
            {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
          catch (e)
            {
            try
              {
              xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
              }
            catch (e)
              {
              alert("Your browser does not support AJAX!");
              return false;
              }
            }
          }
          xmlHttp.onreadystatechange=function()
            {
            if(xmlHttp.readyState==4)
              {
              document.getElementById('media_content').innerHTML=xmlHttp.responseText;
			  add();
              }
            }
          xmlHttp.open("GET","actions.php?action="+param2+"&id="+param1,true);
          xmlHttp.send(null);
          }
function toggleasd(id)
         {
		 o=document.getElementById(id);
		 o.innerHTML="<img src=imagini/pics/arrow.png style='filter:alpha(opacity=0);-moz-opacity:.0;' />&nbsp;";
		 }
function change_lang(to)
         {
		 if (location.href.indexOf('www.')!=-1)
		    {
		    uri=location.href.replace('http://www.interiordesigner.ro','');
			}
	     else
		    {
		    uri=location.href.replace('http://interiordesigner.ro','');
			}
	     if (uri.indexOf('/en/')!=-1)
		    {
			uri=uri.replace('/en',to);
			}
		 else if (uri.indexOf('/fr/')!=-1)
		         {
			     uri=uri.replace('/fr',to);
		         }
		 else
		    {
			uri=to+uri;
		    }
	     window.location=uri;
		 }