var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function fcsArrf(obj,value){
	if(obj.value==value){
		obj.value='';
	}
}
function blrArrf(obj,value){
	if(obj.value==''){
		obj.value=value;
	}

}

function fixPNG(myImage) 
{

    if ((version >= 5.5) && (version <7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	   myImage.outerHTML = strNewHTML	  
    }
}


function showhint(toto){

document.getElementById(toto).style.display="block";
document.getElementById("bk_"+toto).style.display="block";

}
function closehint(tor){
document.getElementById("bk_"+tor.id).style.display="none";
tor.style.display="none";

}

function showlast(cid){
var ax = new XHConn();
        ax.connect('show_last.php?cid='+cid+'&lng='+lng,'POST','',on_finish);


}

 var on_finish = function(bx) {
		raspuns=bx.responseText;
		document.getElementById('rght_contnt_indx').innerHTML=raspuns;
		//Sortable.create("list_to_sort", {  onUpdate: function() {  alert(Sortable.serialize("list_to_sort"));}  });
}


function fillcontent(cid){
lng=generallanguage;
var ax = new XHConn();
        ax.connect('http://www.pixelwerk-marketing.com/content.php?cid='+cid+'&lng='+lng,'POST','',on_finish);



}
function dothis(){
alert( Sortable.serialize("list_to_sort"));

}



var zona=new Array("cort1","cort2","cort3");
var tempt;
var tempp;
var generallanguage='EN';
var allowclick=1;


function jump(t,lng){

generallanguage=lng;

if(allowclick==1){
	
	temp1=zona[0];
	temp = t.parentNode;
	d=temp.id;
	
	if(d != zona[0]){
		allowclick=0;
		temp.style.opacity=0.7;
		temp.style.filter='alpha(opacity=70)';
		document.getElementById(temp1).style.opacity=0.7;
		document.getElementById(temp1).style.filter='alpha(opacity=70)';
		document.getElementById(d).style.zIndex="100";
		document.getElementById(temp1).style.zIndex="10";
		tempp=scotmargin(document.getElementById(temp1).style.margin);
	
		document.getElementById(temp1+'colt').src="http://www.pixelwerk-marketing.com/images/"+temp1+".png";
		if(version==6 || version==7){
			fixPNG(document.getElementById(temp1+'colt'));
		}
	
		tempt=scotmargin(document.getElementById(d).style.margin);

		
		move(temp1,d);
		//t.parentNode.style.opacity=0.7;
		//t.parentNode.style.filter='alpha(opacity=70)';

		//temp=t.parentNode.parentNode.firstChild.style.margin;
		//t.parentNode.parentNode.firstChild.style.margin=t.parentNode.style.margin;
		//t.parentNode.style.margin=temp;
	}
}
}
function move(prim,last){
aaa1=document.getElementById(prim);
marginep=aaa1.style.margin;
aaa2=document.getElementById(last);
margines=aaa2.style.margin;
t= scotmargin(marginep);
m= scotmargin(margines);
m=Number(m);
t=Number(t);

if(t<tempt || m>tempp){

	fac=20;
	if((t+fac)>tempt){
		aaa1.style.margin=tempt+"px 0px";
		
		
		}else {
			aaa1.style.margin=t+fac+"px 0px";
		}
		
		if( m-fac < tempp){
			aaa2.style.margin="0px 10px";
		} else {
			aaa2.style.margin=m-fac+"px 10px";
		}
		
		
		
		document.getElementById('rght_contnt_indx').style.opacity=((m-tempp-fac)*fac/100)/10;
		document.getElementById('rght_contnt_indx').style.filter='alpha(opacity='+((m-tempp-fac)*fac/10)+')';
		
		setTimeout('move("'+prim+'","'+last+'")',50);
} else {

stopandreset(prim,last);
}

}

function stopandreset(prim,last){
aaa1=document.getElementById(prim);
aaa1.style.opacity=1;
aaa1.style.filter='alpha(opacity=100)';
aaa2=document.getElementById(last);
aaa2.style.opacity=1;
aaa2.style.filter='alpha(opacity=100)';
aaa2.style.margin="0px 0px";
aaa3=document.getElementById(last+"colt");

aaa3.src="http://www.pixelwerk-marketing.com/images/"+last+"colt.png";
if(version==6 || version==7){
fixPNG(aaa3);
}

aaa2.style.zIndex="10";
aaa1.style.zIndex="50";
for(i=0;i<zona.length;i++){
	if(zona[i]==last){
		zona[i]==prim;
	}
}


	zona[0]=last;

allowclick=1;
paramto=zona[0].substr(4);
document.getElementById('rght_contnt_indx').innerHTML='';
fillcontent(paramto);

showblur(0);



}

function showblur(v){
v=v+1;
if(v+1<10){
	document.getElementById('rght_contnt_indx').style.opacity=v/10;
	document.getElementById('rght_contnt_indx').style.filter='alpha(opacity='+v*10+')';
	
		setTimeout('showblur('+v+')',50);
	} else {
	document.getElementById('rght_contnt_indx').style.opacity=1;
	document.getElementById('rght_contnt_indx').style.filter='alpha(opacity=100)';
	}
}

function scotmargin(str){

return str.substr(0,str.indexOf("px"));


}

function getscreensize(){
size=document.getElementById('mainportofolio').offsetWidth;
return size;
}


function movethecontent(where){
	
	factor=40;
	
	xx=getscreensize();
	d=document.getElementById('mainportofolio');
	s=document.getElementById('secondscreen');
	
xx=getscreensize();
	
	cc=where-factor;
	aax=xx-cc;
	if(cc<0){
	cc=0;
	}
	
	
	if((where > 0)){
		d.style.margin="0px -"+aax+"px";
		s.style.margin="0px "+cc+"px";
		//alert(s.style.margin);
		setTimeout('movethecontent('+cc+')',1);
	}

}
function movethecontent2(where){
	
	factor=40;
	
	xx=getscreensize();
	d=document.getElementById('mainportofolio');
	s=document.getElementById('secondscreen');
	
xx=getscreensize();
	
	cc=where+factor;
	aax=xx-cc;
	if(cc>xx){
	cc=xx;
	}
	
	
	if((cc < xx)){
	
		d.style.margin="0px -"+aax+"px";
		s.style.margin="0px "+cc+"px";
		//alert(s.style.margin);
		setTimeout('movethecontent2('+cc+')',1);
	}

}

function movewindow(xog){
	lng=generallanguage;
	var ax = new XHConn();
        ax.connect('http://www.pixelwerk-marketing.com/displayinfo.php?pid='+xog+'&lng='+lng,'POST','',on_finish_portofolio);
	 
}
function scotmargin2(str){
//fuk=str.substr(0,str.length-2);
//alert(fuk);
//fog=fuk.substr((fuk.indexOf("px")+1),(fuk.length-3));
//alert(fog);
return str;


}
 var on_finish_portofolio = function(bx) {

		raspuns=bx.responseText;
		
		document.getElementById('secondscreen').innerHTML=raspuns;
		movethecontent(getscreensize());
		//Sortable.create("list_to_sort", {  onUpdate: function() {  alert(Sortable.serialize("list_to_sort"));}  });
}
function calculateh(){
	var browser=navigator.appName;
	
	var headh=document.getElementById('header').offsetHeight;
	var footh=document.getElementById('footer').offsetHeight;
	var menuh=document.getElementById('men').offsetHeight;
	switch(browser){
	case 'Opera':
	wheight=document.body.clientHeight;
	break;
	case 'Netscape':
	wheight=document.documentElement.clientHeight;
	break;
	case 'Microsoft Internet Explorer':
	wheight=document.documentElement.clientHeight;
	break;
	}
	rr=wheight-headh-conh-menuh-footh;
	if(rr>0){
	document.getElementById('mmm').style.height=rr.toString()+"px";
	}
	//alert(wheight-conh-headh);
	
}
function changepict(mode){
pose=document.getElementById('pozeservices');
if(mode==1){
	poza='http://www.pixelwerk-marketing.com/images/serv_hm_1.jpg';
}
if(mode==2){
	poza='http://www.pixelwerk-marketing.com/images/serv_hm_2.jpg';
}
if(mode==3){
	poza='http://www.pixelwerk-marketing.com/images/serv_hm_3.jpg';
}
if(mode==4){
	poza='http://www.pixelwerk-marketing.com/images/serv_hm_4.jpg';
}
if(mode==5){
	poza='http://www.pixelwerk-marketing.com/images/client_serv.jpg';
}
if(mode==6){
	poza='http://www.pixelwerk-marketing.com/images/micro_serv-13.jpg';
}
if(mode==0){
	poza='http://www.pixelwerk-marketing.com/images/serv_hm_2.jpg';
}

pose.src=poza;

}





function cameleon(r,g,b){
//document.body.style.background='url(http://pixelwerk.mobi/pixelwerk/makeimage.php?w=1&h=600&r='+r+'&g='+g+'&b='+b+'&f=255)';
document.body.style.background='rgb('+r+","+g+","+b+')';
stoc=new stiva();


stoc.max=Math.max(r,g,b);
stoc.min=Math.min(r,g,b);

if((stoc.max==r || stoc.max==b) && (stoc.min==r || stoc.min==b)){

stoc.which="g";
}

if((stoc.max==r || stoc.max==g) && (stoc.min==r || stoc.min==g)){

stoc.which="b";
}

if((stoc.max==g || stoc.max==b) && (stoc.min==g || stoc.min==b)){

stoc.which="r";
}
stoc.plaja=stoc.max-stoc.min;

stoc.ro=r;
stoc.go=g;
stoc.bo=b;
	
changemore(r,g,b,1);




}

function changemore(r,g,b,times){
if(b<0){
b=0;
}
if(r<0){
r=0;
}
if(g<0){
g=0;
}
if(b>255){
b=255;
}
if(r>255){
r=255;
}
if(g>255){
g=255;
}





		//alert(stoc.which);
		switch (stoc.which){
			case "r":
	
				if((r> stoc.min && r<stoc.max) || (r==stoc.min && stoc.sign==1) || (r==stoc.max && stoc.sign==-1) ){
					r=r+1*stoc.sign;
				} else {
						stoc.sign*=-1;
						
						
							stoc.which="g";
						
					
						
					
					
				
				
				}
				
				break;
			case "g":
				if((g>stoc.min && g <stoc.max) || (g==stoc.min  && stoc.sign==1) || (g==stoc.max  && stoc.sign==-1)){
					g=g+1*stoc.sign;
				} else {
					
					stoc.sign*=-1;
					
				
							stoc.which="b";
					
						
					
				}
	break;

			case "b":
				if((b>stoc.min && b <stoc.max) || (b==stoc.min  && stoc.sign==1) || (b==stoc.max  && stoc.sign==-1)){
					b=b+1*stoc.sign;
				} else {
					
						stoc.sign*=-1;
							stoc.which="r";
						
						
					
				}
	break;

		}





//document.getElementById('contor').value=times;
times++;

	if(times > (stoc.plaja*6)){
		times=1;
		stoc.doit=1;
	} 



		//document.body.style.background='url(http://pixelwerk.mobi/pixelwerk/makeimage.php?w=1&h=600&r='+ r +'&g='+ g +'&b='+b+'&f=255)';
		document.body.style.background='rgb('+r+","+g+","+b+')';
		setTimeout('changemore('+r+','+g+','+b+','+times+')',1);
	
}




function stiva(){
this.max=255;
this.min=0;
this.ro=100;
this.go=100;
this.bo=100;
this.r=100;
this.g=100;
this.b=100;
this.plaja=this.max-this.min;
this.sign=-1;
this.which='';
this.doit=0;
}

function expand(t,id){
d=document.getElementById('expand'+id);
if(d.style.display=='block'){
d.style.display='none';
} else {
d.style.display='block';
}

}


function calculate(){

stoc=new stiva();

}




function stiva(){

div1prim=document.getElementById('div1');

this.valoareW = div1prim.offsetWidth;
valoareH = div1prim.offsetHeight;

if(this.valoareW<450){
this.valoareW=450;
}
this.pisc= new Array();

this.arraypict=getElementsByName_iefix("div", "pozele")
this.pisc[0]=new Array(0,0);
for(i=1;i<=this.arraypict.length;i++){

elex=scotmargin(this.arraypict[i-1].style.marginLeft)
eley=scotmargin(this.arraypict[i-1].style.marginTop)
this.pisc[i]=new Array(-elex,-eley);
}
this.positia=1;
}

function getElementsByName_iefix(tag, name) {
     
     var elem = document.getElementsByTagName(tag);
     var arr = new Array();
     for(i = 0,iarr = 0; i < elem.length; i++) {
          att = elem[i].getAttribute("name");
          if(att == name) {
               arr[iarr] = elem[i];
               iarr++;
          }
     }
     return arr;
}
function moveit(x,y){
	stopit=0;
	factx=50;
	divele= new Array();

	//p=document.getElementById('puc');
	//s=document.getElementById('sec');
	//t=document.getElementById('trr');
	//f=document.getElementById('frr');
	//ci=document.getElementById('crr');
	//sa=document.getElementById('srr');
	
	rrr=stoc.positia;
	www=stoc.pisc[rrr][0];
	wwy=stoc.pisc[rrr][1];

	
	if(www-x<-stoc.valoareW || x-www<-stoc.valoareW){
	factx=50;
	}

	
	
	if(x >www){
			x-=factx;
				if(x<www){
					x=www;
				}
			stopit=1;
	} else {
		if(x<www){
			x+=factx;
				if(x>www){
					x=www;
				}
			stopit=1;
		}
	
	}
	
	if( y >wwy){
			y-=15;
			if(y<wwy){
				y=wwy;
			}
			stopit=1;
	} else {
		if(y <wwy){
		
			y+=15;	
			if(y>wwy){
				y=wwy;
			}
			stopit=1;
		}
	
	}

		for(i=0;i<stoc.arraypict.length;i++){
		
		stoc.arraypict[i].style.left=x+"px";
		stoc.arraypict[i].style.top=y+"px";
	}
	
	
		if(stopit!=0){
		
			hoho=setTimeout('moveit('+x+','+y+')',1);
		}
	
	
	
}
function stepbymove(va,t){
	xyz=stoc.positia;
	cummisca=2-va;
	sss=cummisca+xyz;
	if(va==1){
		if(sss >= stoc.arraypict.length){
			t.style.display="none";
			document.getElementById('taroma').style.display="block";
		}

	}
	if(va==3){
		if(sss <= 1){
			t.style.display="none";
			document.getElementById('taromb').style.display="block";
		}

	}


getstare(cummisca+xyz,"f");
 verificastare();
}
function verificastare(){
xyz=stoc.positia;
	if(xyz >1 && xyz<stoc.arraypict.length){
	document.getElementById('taromb').style.display="block";
	document.getElementById('taroma').style.display="block";
			
	}
	if(xyz <=1){
	document.getElementById('taromb').style.display="block";
	document.getElementById('taroma').style.display="none";
			
	}
	if(xyz >=stoc.arraypict.length){
	document.getElementById('taroma').style.display="block";
	document.getElementById('taromb').style.display="none";
			
	}

}

function getstare(where,how){
		
	
	xyz=stoc.positia;

	if(how=='f'){
				
			//document.getElementsByName('m'+xyz).style.background="";
			facx=stoc.pisc[xyz][0];
			facy=stoc.pisc[xyz][1];
			stoc.pisc[0][0] = stoc.pisc[where][0];
			stoc.pisc[0][1] = stoc.pisc[where][1];
			//stoc.pisc[0] = stoc.pisc[where];
			
			stoc.positia=where;
			verificastare();
			moveit(facx,facy);
			 
	}
	
	if(how=='d'){
		
		facx=stoc.pisc[xyz][0];
		facy=stoc.pisc[xyz][1];
		stoc.pisc[0][1]-=100;
		
		
		stoc.positia=where;
		moveit(facx,facy);
	
	}
	if(how=='u'){
		
		facx=stoc.pisc[xyz][0];
		facy=stoc.pisc[xyz][1];
		stoc.pisc[0][1]+=100;
		
		
		stoc.positia=where;
		moveit(facx,facy);
	
	}
	if(how=='l'){
		facx=stoc.pisc[xyz][0];
		facy=stoc.pisc[xyz][1];
		stoc.pisc[0][0]+=100;
		
		
		stoc.positia=where;
		moveit(facx,facy);
	
	}
	if(how=='r'){
		
		facx=stoc.pisc[xyz][0];
		facy=stoc.pisc[xyz][1];
		stoc.pisc[0][0]-=100;
		
		stoc.positia=where;
		moveit(facx,facy);
	
	}

}

var banlist= new Array();

//function changepict(t){
	//document.getElementById('pozanews').src=document.getElementById('n'+t.id).src;
//}

function shownews(t){
	dontdoit=1;

	for(i=0;i<banlist.length;i++) {
		if(banlist[i]=='a'+t.id){
			dontdoit=0;
		} else {
			dontdoit=1;
		}
	}
	
	if(dontdoit==1){
			banlist.push('a'+t.id);
			d=document.getElementById('a'+t.id);
			t.style.background = "#e9e9e9";
			if(d.style.display=="block"){

				strange('a'+t.id);

			} else {
				d.style.height=0;
				creste('a'+t.id);

			}

	}
}
function overnews(t,x){
if(x){
t.style.background="#e9e9e9";
t.style.cursor='hand';
t.style.cursor='pointer';
} else {
t.style.background="";
}
}
function strange(e){
aar=document.getElementById('aa'+e);
	t=document.getElementById(e);

	if(t.offsetHeight>0){
		if(t.offsetHeight-15>0){
		t.style.height=t.offsetHeight-15+"px";
		} else {
		t.style.height=0;
		aar.style.background="bottom left url('http://www.pixelwerk-marketing.com/images/arrow-square.gif')"
		}
		
		setTimeout('strange("'+e+'")',10);
	} else {
		for(i=0;i<banlist.length;i++) {
			if(banlist[i]==e){
			banlist.splice(i,1);
			}
		}
		t.style.display='none';
	}

}
function creste(e){
	
	t=document.getElementById(e);
	g=document.getElementById('a'+e);
	aar=document.getElementById('aa'+e);
	t.style.display='block';
	if(t.offsetHeight<g.offsetHeight){
		if(t.offsetHeight+15<g.offsetHeight){
		t.style.height=t.offsetHeight+15+"px";
		} else {
			for(i=0;i<banlist.length;i++) {
				if(banlist[i]==e){
					banlist.splice(i,1);
				}
			}
			t.style.height=g.offsetHeight+"px";
			aar.style.background="top left url('http://www.pixelwerk-marketing.com/images/arrow-square.gif')"
		}
		
		setTimeout('creste("'+e+'")',10);
	} 

}

