

function set_gruppenfoto(g,m,maximum,pos,lan,id,sid,br,tp,obj){
if(!document.getElementById("popdiv")){
if(document.getElementById("a"+pos+id)){	
	ini_lightbox(0,(document.getElementById("a"+pos+id).parentNode.parentNode.offsetTop-200));
}else{
ini_lightbox(0);	
}		
call('generalscripts/show_gruppenfotos.php?g='+g+'&m='+m+'&pos='+pos+'&lan='+lan+'&id='+id+'&sid='+sid+'&maximum='+maximum+'&br='+br+'&tp='+tp);
}}

function popwindow(shop,g,m,maximum,imgindex,lan,sizeX,sizeY,imgpath,ordner,user_id,user_name,brand,bewertung,stimmen,liebe,spass,bravo,agress,crazy,donno,p_emotion,p_eval,p_fav,pos,sid,visitor_id,favorite,br,tp){

// SPRACHE
//9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
if(lan=='de'){
var abc=Array('in die Ablage kopieren \r\n Internet Explorer','auf die Shopping Card','noch nicht bewertet','na ja','okay','Super','Mega','Top',' von 10','Liebe','Spass','Super','Böse','Verrückt','weiss nicht','Favorit');
	
}else{
var abc=Array('copy to clipboard \r\n(internet explorer)','add to the Shopping Card','not quoted yet','better than nothing','okay','super','super geil','Top',' of 10','Love','Fun','Great','Agressiv','Crazy','donno','Favorite');
}
// SPRACHE
//9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
	
	
	
var el=new Object();
var el1=document.getElementById("popimg");
var str=new String();
el=document.createElement("DIV");
el.style.textAlign="center";
el.style.paddingBottom="1em";

el1.appendChild(el);
el=document.createElement("IMG");

el.src='ben/'+user_name+'/fotos/'+ordner+'/v/'+imgpath;

el.setAttribute("id","img_preview");
el.className="zoom";

if (window.innerHeight){
	//firefox trash_can:
	var myHeight=window.innerHeight;
	var myWidth=window.innerWidth;
	el1.style.left=(parseInt(myWidth/2)-310)+"px";
	el1.style.marginTop=30+"px";
}else{
	el1.style.marginLeft=-310+"px";
el1.style.marginTop=60+"px";
}
el1.lastChild.appendChild(el);

el=document.createElement("DIV");
el.style.paddingBottom="0.5em";
el1.appendChild(el);

// clipboard function
el=document.createElement("IMG");
el.style.marginRight="0.5em";
el.setAttribute("title",abc[0]);
el.setAttribute("src","bilder/copy.gif");
el.onclick=function(){clipboardData.setData("Text",this.parentNode.childNodes[1].value,true);};
el1.lastChild.appendChild(el);

el=document.createElement("INPUT");
el.setAttribute("id","url_link");
el.style.width="60%";
el.setAttribute("value",'http://www.fincy.com/foto/ben/'+user_name+'/fotos/'+ordner+'/'+imgpath);

el.onmouseover=function(){sel(this);};
el1.lastChild.appendChild(el);


// Warenkorb
el=document.createElement("IMG");
el.style.marginLeft="5em";
el.setAttribute("title",abc[1]);
el.setAttribute("id","shoppingcard");

if(shop==1){
	el.setAttribute("src","bilder/ware/fill_me.png");
	el.onclick=function(){call('scripts/fill_basket.php?user_id='+user_id+'&img='+imgindex);};
}else{
	el.setAttribute("src","bilder/ware/basket.png");
	el.onclick=function(){call('scripts/fill_basket.php?user_id='+user_id+'&img='+imgindex+'&reset=1');};
}

el1.lastChild.appendChild(el);

var strcams=new String('');
if(br && br!='')strcams='&br='+br+'&tp='+tp;

// navigation
el=document.createElement("DIV");
el.className="corner";
el1.appendChild(el);
el=document.createElement("IMG");
el.src="bilder/arr_white_back.jpg";
if(pos>0){
el.onclick=function(){remove_content('generalscripts/show_gruppenfotos.php?g='+g+'&m='+m+'&maximum='+maximum+'&lan='+lan+'&sid='+sid+'&pos='+(pos-1)+strcams);};
}else{
el.onclick=function(){remove_content('generalscripts/show_gruppenfotos.php?g='+g+'&m='+m+'&maximum='+maximum+'&lan='+lan+'&sid='+sid+'&pos='+(maximum-2)+strcams);};
}
el1.lastChild.appendChild(el);

el=document.createElement("IMG");
el.src="bilder/x_white.gif";
el.onclick=function(){removeDiv(this.parentNode.parentNode);};
el1.lastChild.appendChild(el);
el=document.createElement("IMG");
el.src="bilder/arr_white.gif";
if(pos<(maximum-2)){
el.onclick=function(){remove_content('generalscripts/show_gruppenfotos.php?g='+g+'&m='+m+'&maximum='+maximum+'&lan='+lan+'&sid='+sid+'&pos='+(pos+1)+strcams);};
}else{el.onclick=function(){remove_content('generalscripts/show_gruppenfotos.php?g='+g+'&m='+m+'&maximum='+maximum+'&lan='+lan+'&sid='+sid+'&pos='+(0)+strcams);};
}
el1.lastChild.appendChild(el);


var eval_stimmen;
if(bewertung>0 && stimmen>0)eval_stimmen=parseInt(bewertung/stimmen*10)/10;
else eval_stimmen=abc[2];

var el=document.createElement('DIV');
el.className='bar';
	el.style.height="50px";

	
var el2=document.createElement('DIV');
el2.setAttribute('id','evalbar');
el2.className="fright";

if(eval_stimmen>0){eval_img='bilder/star.gif';
}else eval_img='bilder/star_out.gif';			
el2.appendChild(create_stars_bar(lan,abc[3],eval_img,1,2,5,imgindex,-1,sid,visitor_id,stimmen,bewertung,p_eval));

if(eval_stimmen>2)eval_img='bilder/star.gif';
else eval_img='bilder/star_out.gif';
el2.appendChild(create_stars_bar(lan,abc[4],eval_img,1,4,5,imgindex,-1,sid,visitor_id,stimmen,bewertung,p_eval));

if(eval_stimmen>4)eval_img='bilder/star.gif';
else eval_img='bilder/star_out.gif';
el2.appendChild(create_stars_bar(lan,abc[5],eval_img,1,6,5,imgindex,-1,sid,visitor_id,stimmen,bewertung,p_eval));

if(eval_stimmen>6)eval_img='bilder/star.gif';
else eval_img='bilder/star_out.gif';	
el2.appendChild(create_stars_bar(lan,abc[6],eval_img,1,8,5,imgindex,-1,sid,visitor_id,stimmen,bewertung,p_eval));

if(eval_stimmen>8)eval_img='bilder/star.gif';
else eval_img='bilder/star_out.gif';	

el2.appendChild(create_stars_bar(lan,abc[7],eval_img,1,10,5,imgindex,-1,sid,visitor_id,stimmen,bewertung,p_eval));	

		// wegen dem Float in ff muss ein zeilenumbruch geschrieben werden
		if(navigator.userAgent.indexOf('MSIE')==-1){el2.appendChild(document.createElement('BR'));}
		el2.appendChild(document.createElement('DIV'));
		el2.lastChild.style.textAlign='center';

		el2.lastChild.appendChild(document.createElement('SPAN'));
		el2.lastChild.lastChild.setAttribute('id','eval_value');
		el2.lastChild.lastChild.appendChild(document.createTextNode(eval_stimmen));

		el2.lastChild.appendChild(document.createElement('SPAN'));
		el2.lastChild.lastChild.setAttribute('id','eval_text');
		
		if(eval_stimmen>0)
		el2.lastChild.lastChild.appendChild(document.createTextNode(abc[8]));
		
		el.appendChild(el2);

	el2=document.createElement('DIV');
	el2.setAttribute('id','emotionbar');
	
	if(p_fav==1)str='1';else str=0;
		el2.appendChild(create_stars_bar(lan,abc[9],'bilder/s_love.gif',2,1,10,imgindex,liebe,sid,visitor_id,stimmen,bewertung,p_emotion));		
		el2.appendChild(create_stars_bar(lan,abc[10],'bilder/s_fun.gif',2,2,10,imgindex,spass,sid,visitor_id,stimmen,bewertung,p_emotion));		
		el2.appendChild(create_stars_bar(lan,abc[11],'bilder/s_wow.gif',2,3,10,imgindex,bravo,sid,visitor_id,stimmen,bewertung,p_emotion));		
		el2.appendChild(create_stars_bar(lan,abc[12],'bilder/s_boese.gif',2,4,5,imgindex,agress,sid,visitor_id,stimmen,bewertung,p_emotion));	
		el2.appendChild(create_stars_bar(lan,abc[13],'bilder/s_weird.gif',2,5,10,imgindex,crazy,sid,visitor_id,stimmen,bewertung,p_emotion));
		el2.appendChild(create_stars_bar(lan,abc[14],'bilder/s_dontknow.gif',2,6,10,imgindex,donno,sid,visitor_id,stimmen,bewertung,p_emotion));
		el2.appendChild(create_stars_bar(lan,abc[15],'bilder/fav'+str+'.gif',3,favorite,10,imgindex,-1,sid,visitor_id,stimmen,bewertung));	
			
		el.appendChild(el2);

	el1.appendChild(el);

}

function replace_str(v){var rExp = /&/gi;
var str=v.replace(rExp,'^^^');rExp = /"/gi;
str=str.replace(rExp,'``');return str;}

function remove_content(query){
var obj=document.getElementById("popimg");
obj.innerHTML='';
var el=document.createElement("DIV");
el.setAttribute("id","text_info");
el.className="infobox";
obj.appendChild(el);
el=document.createElement("DIV");
el.style.width="100%";
obj.lastChild.appendChild(el);
call(query);
}
function sel(obj){obj.focus();obj.select();}

function create_stars_bar(lan,text,img,set,v,margin,n,nr,sid,visitor_id,stimmen,bewertung,p){
	
	
	
	var el2=new Object(document.createElement('DIV'));
	el2.className='fleft';	

	el2.appendChild(document.createElement('A'));
	
	if(!visitor_id || visitor_id==0 && set!=3){
		
		// SPRACHE
		//9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
		
		if(lan=='de'){
		var	errortext="Für Emotions oder Bewertungen musst du dich erst einloggen !";
		
		}else{
			
		var	errortext="To set emotions or evaluations you have to login before !";
		
		}
		// SPRACHE
		//9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
		

		
		el2.lastChild.setAttribute('href','javascript:alert(\''+errortext+'\')');
		
	}
	else if(p>0 && set!=3){
		
			// SPRACHE
		//9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
		
		if(lan=='de'){
			
		var	errortext="Es wird nur die erste Emotion oder Bewertung gespeichert.";
		
		}else{
			
		var	errortext="We save only your first impression or evaluation !";
		
		}
		// SPRACHE
		//9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
	
		el2.lastChild.setAttribute('href','javascript:alert(\''+errortext+'\')');
		
		
	}
	else if(visitor_id>0){
		el2.lastChild.setAttribute('href','javascript:call("generalscripts/emotions.php?val='+v+'&n='+nr+'&set='+set+'&img_index='+n+'&user_id='+visitor_id+'&sid='+sid+'&stimmen='+stimmen+'&eval='+bewertung+'")');
	
	}else{
				// SPRACHE
		//9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
		
		if(lan=='de'){
			
		var	errortext="Für Favoriten muss du dich einloggen.";
			
		}else{
			
		var	errortext="To add favorites you have to login before.";
		
		}
		// SPRACHE
		//9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
	
		 el2.lastChild.setAttribute('href','javascript:alert(\''+errortext+'\')');
		 
		 
	 }

	el2.lastChild.appendChild(document.createElement('IMG'));
	el2.lastChild.lastChild.style.margin='0 '+margin+'px 0 '+margin+'px';

	if(set==3)el2.lastChild.lastChild.setAttribute('id','favorite');
	
 	el2.lastChild.lastChild.style.border='none';
	el2.lastChild.lastChild.src=img;
	el2.lastChild.lastChild.setAttribute("title",text);
	el2.lastChild.lastChild.setAttribute("alt",text);
	
	if(set==2){
	el2.appendChild(document.createElement('BR'));
	el2.appendChild(document.createElement('SPAN'));
	el2.lastChild.appendChild(document.createTextNode(nr));
	}
	return el2;
}


function set_post(user_id,img_index,sid,lan,cp){
var obj=document.getElementById("post_entry");

if(obj.value.length>19 && user_id>0){
		str=replace_str(obj.value)
		var str1=new String();
		
		for(t=0;t<str.length;t++){if(str.charCodeAt(t)==10){
			if(str.charCodeAt(t-1)==10){str1+=' ';
			}else{
			str1+='¤';}
			}else{str1+=str.charAt(t);}}

			call('scripts/insert_new_post.php?user_id='+user_id+'&sid='+sid+'&cp='+cp+'&img_index='+img_index+'&v='+str1+'&lan='+lan);

}else if(obj.value.length<15){
	
			// SPRACHE
		//9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
		
		if(lan=='de'){
		var	errortext="Dein Post is echt zu kurz, \r\ndann topp mal besser ein Sticker !";
		
		}else{
			
		var	errortext="Your Post is much too short, \r\nYou better top a sticker than !";
		
		}
		// SPRACHE
		//9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
			
	alert(errortext);

}else if(!user_id){
				// SPRACHE
		//9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
		
		if(lan=='de'){
		var	errortext="Irgendwie ist dein Login nicht mehr gültig. Log dich bitte nochmal ein";
				
		}else{
			
		var	errortext="Somehow your login is not valid anymore. Please login again";
		
		}
		// SPRACHE
		//9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
	alert(errortext);

}
}


function set_kategorien(el1,m,index,lan,c1,c2,c3,c4,strkat){


if(!index){
	var el=document.createElement("A");
	el.setAttribute("href","../../kats.php?m="+m+"&index="+index+"&lan="+lan);
}else{
el=document.createTextNode("->");
el1.lastChild.appendChild(el);
var el=document.createElement("A");

	if(c4>-1){
	el.setAttribute("href","../../kats.php?m="+m+"&index="+index+"&lan="+lan+"&c4="+c4+"&c1="+c1+"&c2="+c2+"&c3="+c3);
}else if(c3>-1){
	el.setAttribute("href","../../kats.php?m="+m+"&index="+index+"&lan="+lan+"&c3="+c3+"&c1="+c1+"&c2="+c2);
}else if(c2>-1){
	el.setAttribute("href","../../kats.php?m="+m+"&index="+index+"&lan="+lan+"&c2="+c2+"&c1="+c1);
}else if(c1>-1){
	el.setAttribute("href","../../kats.php?m="+m+"&index="+index+"&lan="+lan+"&c1="+c1);
}}

el.style.margin="0 0.5em 0 0.5em"
el1.lastChild.appendChild(el);

el=document.createTextNode(strkat);
el1.lastChild.lastChild.appendChild(el);
}

//=============================================================

