
var br = getBrowser();

var width=screen.width;
var height=screen.height;



/* START WRITE OUTER NECKLACE */

function checkMedia(frm,field,ext)
{	
	if(frm && field && ext)
	{
		file=frm[field].value;
		if(ext.join)
		{	extReg=ext.join(")|(")
			extInfo=ext.join(' oder ').toLowerCase();
		}
		else
			extInfo=extReg=ext;
		
		if(file.toLowerCase().match(new RegExp("("+extReg+")$")))
			return true;
		else
		{	lightboxAlert('Bitte nur Dateien im Format '+extInfo+' hochladen!','<a href="javascript:hideLightbox()">OK</a>');
			return false;
		}
	}
	else
	{	return false;
	}
}

function write_teaser_top(){				
	if (width<1280)
	{	document.getElementById("start_teaser_top").style.width='475px';
	}
}

function write_teaser_bottom(){				
	if (width<1280)
	{	document.getElementById("start_teaser_bottom").style.width='485px';
	}
}


/* END WRITE  OUTER NECKLACE */


function processPNGs()
{	if((br=='IE')||(br=='NETSCAPE 8 - IE RENDERING'))
	{	//alert('IE');
		imgs=document.getElementsByTagName('img');
		for(var i=imgs.length-1;i>=0;i--)
		{	if(imgs[i].className=='png')
			{	var src=imgs[i].src;
				src=src.replace(/%26/,'%2526');
				imgs[i].outerHTML='<span style="font-size:0px;display:inline; width:1;height:1;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='+src+', sizingMethod=\'image\');"></span>';
			}
		}
	}
}



/* START GET BROWSER */

function getBrowser(){
	var agt=navigator.userAgent.toLowerCase();

   if((agt.indexOf("msie") != -1)&&
   	(agt.indexOf("netscape/8") == -1)&&	 //making sure we are not detecting NN8 in IE mode
   	(agt.indexOf("opera") == -1)){       //making sure we are not detecting older opera-versions
   	return "IE";	
   }	
   if(agt.indexOf("firefox") != -1){
   	return "FIREFOX";
   }
    if(agt.indexOf("safari") != -1){
   	return "SAFARI";	
   }
   if((agt.indexOf("netscape/8") != -1)&&(agt.indexOf("msie") != -1)){
   	return "NETSCAPE 8 - IE RENDERING";
   }
   if((agt.indexOf("netscape/8") != -1)&&(agt.indexOf("msie") == -1)){
   	return "NETSCAPE 8 - FF RENDERING";
   }
   if(agt.indexOf("netscape/7") != -1){
   	return "NETSCAPE 7";
   }
   if(agt.indexOf("opera") != -1){
   	return "OPERA";
   }
   if(agt.indexOf("camino") != -1){
   	return "CAMINO";
   }	
}

/* END GET BROWSER */




/* START GENERAL ROLLOVER*/


function swap(obj,bild){
	obj.firstChild.src = bild;
}


/* END GENERAL ROLLOVER*/



function repos(){				
	if (width<1280){
		document.getElementById("holdinpic").style.marginTop='-67px';
	}
}

function spielregeln()
	{
	url='spielregeln_popup.php';
	wid=660;
	hei=550;
	fenster=window.open(url,"pop","width="+wid+",height="+hei+",scrollbars=yes,resizable=no,top="+(screen.height / 2 - hei/2)+",left="+(screen.width / 2 -wid/2));
}

function spielregeln_single()
	{
	url='spielregeln_single_popup.php';
	wid=660;
	hei=550;
	fenster=window.open(url,"pop","width="+wid+",height="+hei+",scrollbars=yes,resizable=no,top="+(screen.height / 2 - hei/2)+",left="+(screen.width / 2 -wid/2));
}

function sendtofriendregeln()
	{
	url='sendtofriendregeln_popup.php';
	wid=660;
	hei=510;
	fenster=window.open(url,"pop","width="+wid+",height="+hei+",scrollbars=yes,resizable=no,top="+(screen.height / 2 - hei/2)+",left="+(screen.width / 2 -wid/2));
}


function galpopup(userid)
	{
	url='gal_popup.php?userid='+userid;
	wid=435;
	hei=480;
	fenster=window.open(url,"galpop","width="+wid+",height="+hei+",scrollbars=no,resizable=no,top="+(screen.height / 2 - hei/2)+",left="+(screen.width / 2 -wid/2));
}

function galpopupgallery(userid,num)
	{
	url='gal_popup_gallery.php?folder='+userid+'&picnum='+num;
	wid=435;
	hei=480;
	fenster=window.open(url,"galpop","width="+wid+",height="+hei+",scrollbars=no,resizable=no,top="+(screen.height / 2 - hei/2)+",left="+(screen.width / 2 -wid/2));
}


function votetmp()
	{
	parent.lightboxAlert('Danke fia dei Herzerl.','<a href="javascript:hideLightbox()" class=txt>zumachen</a><br><br>');	
	}
	
	function deleteAction(performaction,p1,p2,myform,thingie)
	{	if(confirm('Do you really want to delete this '+thingie+'?'))
			setAction(performaction,p1,p2,myform);
	}
	
	function setAction(performaction,p1,p2,myform)
	{	frm=document.getElementById(myform);
		frm.todo.value=performaction;
		frm.p1.value=p1;
		frm.p2.value=p2;
		frm.submit();
	}
	
function showForm(){
	document.getElementById('pbform').style.display = 'block';
}

function submitForm(id){
	document.getElementById(id).submit();
}

function clearForm(id, textid){
	document.getElementById(id).reset();
	document.getElementById(textid).innerHTML = ""
}

function countChars(id, textid, count){
	if(document.getElementById(id).value.length > count) document.getElementById(id).value = document.getElementById(id).value.substring(0,count);
	document.getElementById(textid).innerHTML = '(Noch ' + (count - document.getElementById(id).value.length) + ' Zeichen frei)';
}		