var newwindow;
function MM_openBrWindow(theURL,winName,features) {
  newwindow=window.open(theURL,winName,features);
  if (window.focus) {
    newwindow.focus()
  }
}

function zoom(img)
{
	MM_openBrWindow('/bin/zoom.php?img='+img,'araneszoom','width=537,height=798,scrollbars=1');	
}

function phpcode2(token)
{
	var output = '';
	output += '<'+'?='+' lg(\''+token+'\')'+' ?'+'>\n';
	output += 'lg(\''+token+'\')\n';
	output += '<'+'?='+' lg(\''+token+'\',\'\',false)'+' ?'+'>\n';
	output += 'lg(\''+token+'\',\'\',false)\n';
	document.getElementById('phpcode').value = output;
}

function adminpopup(url)
{
	window.opener.SetUrl(url); 
	window.close(); 
	window.opener.focus();
	
}


function windowwidth () {
  if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.offsetWidth) {
    return document.body.offsetWidth;
  } else {
    return 0;
  }
}

function windowheight () {
  if (window.innerHeight) {
    return window.innerHeight;
  } else if (document.body && document.body.offsetHeight) {
    return document.body.offsetHeight;
  } else {
    return 0;
  }
}


function AccessLog(mod_id,mod,account_id){
	
	var elements='mod_id='+mod_id+'&mod='+mod+'&account_id='+account_id+'&f=ajax';
	new Ajax.Request(	'/bin/accesslog.php',
						{	method: 'post', 
							parameters: elements
						}
					);
		
}

function doNextImg(direction)
{
    var start=parseInt(document.getElementById('start').value);
    var end=parseInt(document.getElementById('end').value);
    var aktuell=parseInt(document.getElementById('aktuell').value);
    var position=parseInt(0);
    
    if(direction == 'back'){
        position=parseInt(aktuell-1);    
    }else if(direction == 'forward'){
        position=parseInt(aktuell+1);     
    }else if(direction == 'now'){ 
       position=aktuell;
    }
    
    if(position == 0) {
        position=parseInt(end-1);  
    } else if(position >= end) {
        position=parseInt(start);    
    }
    
    var bild =document.getElementById('zoom_'+position).src;
    var main = bild.replace("_t.jpg","_z.jpg");
    var title =document.getElementById('zoom_'+position).title;
    var description =document.getElementById('zoom_'+position).alt;

    document.getElementById('aktuell').value=position;
    document.getElementById('mainimg').src=main;
    if(document.getElementById('maintitle')){
        document.getElementById('maintitle').innerHTML=title;    
    }
    if(document.getElementById('maindescription')){
        document.getElementById('maindescription').innerHTML=description;    
    }
    
}

function initializeFlash(swf)
{
    var flashvars = {};
    var params = { scale: "noscale", salign: "tl", wmode: "transparent" };
    var attributes = {};
    swfobject.embedSWF(swf, "flashbanner", "230", "460", "9.0.0","/ARANESLIB/expressInstall.swf", flashvars, params, attributes); 
}

function initializeFlashCross(swf)
{
    var flashvars = {};
    flashvars.settingsXML = "settings_cross.xml";            
    
    var params = {};
    params.scale = "noscale"; 
    params.salign = "tl";
    params.wmode = "transparent";
            
    var attributes = {};
    swfobject.embedSWF(swf, "flashbanner_cross", "941", "241", "9.0.0","/ARANESLIB/expressInstall.swf", flashvars, params, attributes); 
            
}
