// JavaScript Document


//funktion ausw�hlen aller newsletter-kategorien
function user_selectAll(formId,prefix) {
		for(i=0;i<document.getElementById(formId).elements.length;i++) {
			if(document.getElementById(formId).elements[i].name.indexOf("reihe_")!=-1) {
			document.getElementById(formId).elements[i].checked=true;	
			}
		}
	}
	
//funktion abw�hlen aller newsletter-kategorien
function user_unselectAll(formId,prefix) {
	for(i=0;i<document.getElementById(formId).elements.length;i++) {
			if(document.getElementById(formId).elements[i].name.indexOf("reihe_")!=-1) {
			document.getElementById(formId).elements[i].checked=false;	
			}
		}
	
	}
	
	
	

//funktion zur anzeige von Typo3-Links im FE f�r Redakteure
function userShowTypo3Link(fieldId,linkStr) {
	
	myFieldWidth=linkStr.length*7;
	
	if(myFieldWidth>450) {
		myFieldWidth=450;
		}
	
	document.getElementById(fieldId).style.visibility='visible';
	document.getElementById(fieldId).style.width=myFieldWidth+'px';
	
	if(document.getElementById(fieldId).value=='') {
		document.getElementById(fieldId).value=linkStr;
		document.getElementById(fieldId).style.visibility='visible';
		} else {
		document.getElementById(fieldId).value=''
		document.getElementById(fieldId).style.visibility='hidden';
		}
	
	
	}


//flash buecherplayer einbinden wenn javascript aktiviert (und flash!!!)

function userIncludeBuecherPlayer(width,height) {

	if(document.getElementById('userMainContentNormalFlash')) {

	document.getElementById('userMainContentNormalFlash').innerHTML="<iframe id=\"userIframeBuecherPlayer\" name=\"userIframeBuecherPlayer\" scrolling=\"no\" name=\"targetFrame\" frameborder=\"0\" src=\"./fileadmin/user_php/buecher_player.php\" style=\"width:"+width+"px;height:"+height+"px;border:0px; background-color:#FFFFFF\" ></iframe>";
	} else {
		
		alert('scheinbar kein Flash installiert!');
		}

}



//Bilder vorausladen



userImages = new Array();



function userPreloadImages() {

    if (document.images)

    {



       var i = 0;

       for(i=0; i<document.images.length; i++) {

         if(document.images[i].src.search(/user_thumbs/)!=-1) {

			userImages[i+1000]=document.images[i].src.replace(/user_thumbs/,'user_medium');

			 }

			 

	   }

    }

}




function userTrackResize() {
	
	if(document.getElementById('userWindowWidth') && document.getElementById('userWindowHeight')) {

		if (window.innerWidth) {
	
		myWindowWidth=window.innerWidth;
	
		} else if (document.body && document.body.offsetWidth) {
	
		myWindowWidth=document.body.offsetWidth;
	
		} else {
	
		myWindowWidth=0;
	
		}
	
		
	
		if (window.innerHeight) {
	
		myWindowHeight=window.innerHeight;
	
		} else if (document.body && document.body.offsetHeight) {
	
		myWindowHeight=document.body.offsetHeight;
	
		} else {
	
		myWindowHeight=0;
	
		}
	
		
	
		document.getElementById('userWindowWidth').value=myWindowWidth;
	
		document.getElementById('userWindowHeight').value=myWindowHeight;
	}

}

	

	



	

function zoomClose(pfad,bildbreite,bildhoehe) {

	document.getElementById('userBildcontainerDiv').style.visibility='hidden';

	document.getElementById('userBildcontainer').innerHTML='';

	

		for (i=0;i<document.getElementsByTagName('div').length;i++) {

			if(navigator.appName.indexOf("Explorer") == -1) {

			document.getElementsByTagName('div')[i].focus();

			}

		}

		

		if(navigator.appName.indexOf("Explorer") == -1) {

			document.getElementsByTagName('div')[0].focus();

		}

	}

	



function userNewImageObj(width,height,pfad,linktext) {

	objImage = new Image();

	objImage.src=pfad;

	

	objImage.onLoad=document.getElementById('userBildcontainer').style.backgroundImage='url('+pfad+')';

	objImage.onLoad=document.getElementById('userBildcontainer').style.backgroundRepeat='no-repeat';

	objImage.onLoad=document.getElementById('userBildcontainer').innerHTML='<img src=\"fileadmin/user_pix/blank.gif\" width=\"'+width+'\" height=\"'+height+'\"><div class=\"userBildcontainerClose\" onMouseUp=\"javascript:zoomClose();\"> [ '+linktext+' ]</div>';



	}

	

	

	

function zoomMe(pfad,bildbreite,bildhoehe,linktext,copyright) {
    if(copyright!='') {
        myCopyright = '(c) '+copyright;
    } else {
        myCopyright = '';
    }

	var myWindowWidth=document.getElementById('userWindowWidth').value;

	var myWindowHeight=document.getElementById('userWindowHeight').value;

	



	document.getElementById('userBildcontainerDiv').style.visibility='visible';

	document.getElementById('userBildcontainerDiv').style.width=(myWindowWidth-22)+'px';

	document.getElementById('userBildcontainerDiv').style.borderLeft='3px solid #FFFFFF';

	document.getElementById('userBildcontainerDiv').style.height=myWindowHeight+'px';

	document.getElementById('userBildcontainer').style.marginLeft=(myWindowWidth-bildbreite)/2+'px';

	document.getElementById('userBildcontainer').style.marginTop=(((myWindowHeight-bildhoehe)/2)*0.7)+'px';

	document.getElementById('userBildcontainer').innerHTML='<div class=\"userBildcontainerPreload\" onMouseUp=\"javascript:zoomClose();\" style=\"width:'+bildbreite+'px;height:'+bildhoehe+'px;\"><img style=\"margin-top:'+(bildhoehe/2)+';margin-left:'+((bildbreite-32)/2)+';\" src=\"fileadmin/user_pix/ajax-loader.gif\"></div><p style=\"background-color:#FFFFFF\">'+myCopyright+'</p>';

	

	setTimeout("userNewImageObj('"+bildbreite+"','"+bildhoehe+"','"+pfad+"','"+linktext+"','"+copyright+"');",1000);



	}
	
var transInhaltArray = new Array();

function userTransCheckValue(id) {
	transInhaltArray[id]=document.getElementById(id).value;
}

function userTransCheckChange(id) {
	if(document.getElementById(id).value!=transInhaltArray[id]) {
	document.getElementById(id).style.backgroundColor='#FFFF00';
	}
}


function userGoToSelect(fieldId) {
	document.location.href=document.getElementById(fieldId).options[document.getElementById(fieldId).selectedIndex].value;
	}


var myUplinks;

function writeIsbnUplink(myId) {
	myUplinks += ' ';
	mySearch=myUplinks.indexOf(myId);
		if(mySearch==-1) {
		document.getElementById(myId).innerHTML += '&nbsp;[<a href=\"#\" title=\" up \" class=\"internal-link\" onClick=\"Javascript:history.back()\">&nbsp;&laquo;&nbsp;</a>]';
		myUplinks += myId+' ';
		} 
		
	}

function getIsbn(myId) {
	if(isNaN(myId.value) || myId.value.length>13) {
		myId.value=myId.value.substring(0,myId.value.length-1);
		goTo=false;
		} else if(myId.value!='') {
		myString ='';
		myString += '<option value=\"\">- - -</option>\r\n';
	
				for(var i=0;i<document.anchors.length;i++) {
					if(document.anchors[i].name.substring((13-myId.value.length),13)==myId.value) {
					myString += '<option value=\"'+document.anchors[i].name+'\">'+document.anchors[i].name+'</option>\r\n';
					}
				}
			
				mySelect='<select class=\"userIsbnSelect\" id=\"isbnSelect\" onChange=\"Javascript:document.location.href=\'#\'+this.options[this.selectedIndex].value; if(this.options[this.selectedIndex].value!=\'\') { document.getElementById(\'isbn_\'+this.options[this.selectedIndex].value).style.backgroundColor=\'#FFFF00\'; writeIsbnUplink(\'isbn_\'+this.options[this.selectedIndex].value);}\">'+myString+'</select>&nbsp;';
			
	
	
		document.getElementById('isbnSelectDiv').innerHTML=mySelect;
				if (document.getElementById('isbnSelect').options.length>1) {
				document.getElementById('isbnSelect').options[0].text=document.getElementById('isbnResult').value;
				document.getElementById('isbnInput').style.border='1px solid #009900';
				goTo=false;
				} else {
				document.getElementById('isbnSelect').options[0].text=document.getElementById('isbnNoResult').value;
				document.getElementById('isbnInput').style.border='1px solid #CC0000';
				goTo=false;
				}
			}
	
	if(goTo==false) {
	document.getElementById('isbnInput').focus();
	}
	
	if(myId.value=='') {
		isbnIndex();
		document.getElementById('isbnInput').focus();
		}
	} 
	


function isbnIndex() {
	
	myString ='';
	myString += '<option value=\"\">- - -</option>\r\n';
	
	for(var i=0;i<document.anchors.length;i++) {
			myString += '<option value=\"'+document.anchors[i].name+'\">'+document.anchors[i].name+'</option>\r\n';
			document.getElementById('isbn_'+document.anchors[i].name).style.backgroundColor='#FFFFFF';
		}
	
	myUpLink='&nbsp;[<a href=\"#\" class=\"internal-link\" onClick=\"Javascript:history.back()\">&nbsp;&laquo;&nbsp;</a>]';
	mySelect='<select class=\"userIsbnSelect\" id=\"isbnSelect\" onChange=\"Javascript:document.location.href=\'#\'+this.options[this.selectedIndex].value; if(this.options[this.selectedIndex].value!=\'\') { document.getElementById(\'isbn_\'+this.options[this.selectedIndex].value).style.backgroundColor=\'#FFFF00\'; writeIsbnUplink(\'isbn_\'+this.options[this.selectedIndex].value);}\">'+myString+'</select>&nbsp;';
	
	myField='<input id=\"isbnInput\" value=\"\" class=\"userIsbnInput\" onKeyUp=\"getIsbn(this);\">\r\n';
	
	document.getElementById('isbnSelectDiv').innerHTML=mySelect;
	document.getElementById('isbnInputDiv').innerHTML='&nbsp;'+myField;
	document.getElementById('isbnContainer').style.display='block';
	document.getElementById('isbnInput').focus();
	
	if(navigator.userAgent.indexOf('Safari')!=-1) {
		document.getElementById('isbnInput').style.height='24px';
		}
	
	if(navigator.userAgent.indexOf('MSIE')!=-1) {
		document.getElementById('isbnInput').style.height='19px';
		document.getElementById('isbnInput').style.lineHeight='14px';
		}
	
	}


