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 CheckCounter(anzahl,object)
{
    var string = object.value;
    var length = string.length;
    var available_counts = anzahl- length;

    if(available_counts >= 0 ){
        var class_name = 'green';     
    } else {
        var class_name = 'red';       
    }
    
    var screen = document.getElementById('tweet_screen'); 
    screen.className=class_name; 
    
    var counter = document.getElementById('tweet_counter');    
    counter.innerHTML=available_counts; 
      
}
