var page_loaded = false;
var today = new Date();
var year = today.getFullYear();

window.defaultStatus = "schulungen-nuernberg.de | Copyright 2008-"+year+" WildSurf - Training & Consulting. WildSurf is a privately held company incorporated in Nuremberg Germany, Zollhausstr. 26-28, 90469 Nuernberg";


var defaultSlideId = -1;
var homepage = false;
var we_editmode = false;
var tagcloud = false;
var markerticker = false;

function pageInit()
{
    page_loaded = true;
    
    if (!we_editmode)
    {
        initFont(100);
     // addReflections();
        
        document.getElementById("slider").style.display="block";
        
        if ("true" == homepage)
            { defaultSlideId = 0; SliderCarousel(); }
        
        else
            { slider.s1.slides[defaultSlideId].over(); }
    
        if (tagcloud) { setTimeout("runTagCloud()", 1000); }
        
     /* jQuery.ladeBilderVor("/images/dock/home_mo.png","/images/dock/calendar_mo.png","/images/dock/history_mo.png","/images/dock/video_mo.png");
     */
    }
}


/*
function click (e) 
{
  if (!e) { e = window.event; }
  
  if ((e.type && e.type == "contextmenu") || (e.button && e.button == 2) || (e.which && e.which == 3)) 
  {
    if (window.opera)
        window.alert("Sorry: Diese Funktion ist deaktiviert.");
    return false;
  }
}

if (document.layers) { document.captureEvents(Event.MOUSEDOWN); }

document.onmousedown   = click;
document.oncontextmenu = click;  
*/    
    


jQuery.ladeBilderVor= function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}





submitInfo = function( id, tag, className)
{
    var waiter = "<div><img src=\"/images/content/wait_load_3.gif\" width=\"100\" height=\"10\" alt=\"Bitte warten…\" title=\"Einen Moment bitte…\" border=\"0\" /></div>"; 
    
    var waiter = "<div class=\"blinking red\" style=\"padding-top:10px;\"><i><b>Einen Moment bitte…</b></i></div>";
    
    $("#"+id+" "+tag+"."+className).html(waiter);
}


hideElement = function( id, tag, className)
{
    $("#"+id+" "+tag+"."+className).hide();
}






// MailCrypt-Send-Function 
function UnCryptMailto (value, destination)	
{
    value = Base64.decode(value);
    
    if (!destination)
        location.href = "mailto:" + value.replace(/\[wildsurf\]/,"@");
    else
        location.href = destination;
}




// Popup Win
var popupWin = false;
function PopUp (url, breite, hoehe, x, y, noBorder, scrollbars_onoff)
{

	var fenstereigenschaften = "";
	var win_width  = window.screen.width;
	var win_height = window.screen.height;
	
	//Pruefung, ob zwei Monitore angeschlossen sind
	var secondMon = 0;
	if (win_width >= 1600) {win_width = win_width/2; secondMon=win_width;}

	if (x<0) {x = secondMon+(win_width-breite)/2;} else if (!x){x=0;}
	if (y<0) {y = (win_height-hoehe)/2;} else if (!y){y=0;}
	
	x -= 20;
	
	if (scrollbars_onoff != 1) {scrollbars_onoff = 0;}
	
	if (noBorder <= 0) {
	    fenstereigenschaften = "resizable=0,toolbar=0,scrollbars="+scrollbars_onoff+",fullscreen=0,status=0,directories=0,menubar=0,location=0,width="+breite+",height="+hoehe+",screenX="+x+",left="+x+",screenY="+y+",top="+y;
	} else {
	    fenstereigenschaften = "resizable=1,toolbar=0,scrollbars="+scrollbars_onoff+",fullscreen=0,status=0,directories=0,menubar=0,location=0,width="+breite+",height="+hoehe+",screenX="+x+",left="+x+",screenY="+y+",top="+y;
    }

    popupWin = window.open(url,"WAIT",fenstereigenschaften);
    
    
    /*
    if (popupWin && noBorder > -1) {
        popupWin.focus();
        popupWin.resizeTo(breite,hoehe);
	    popupWin.moveTo(x,y);
	    
	}
	*/
}





// Resizeable Textareas

function countTAlines(strtocount, cols) 
{
    var hard_lines = 1;
    var last = 0;
    while ( true ) {
        last = strtocount.indexOf("\n", last+1);
        hard_lines ++;
        if ( last == -1 ) break;
    }
    var soft_lines = Math.round(strtocount.length / (cols-1));
    var hard = eval("hard_lines  " + unescape("%3e") + "soft_lines;");
    if ( hard ) soft_lines = hard_lines;
    return soft_lines;
}





var tarea_timer = false;
function tarea_resize( form, which ) 
{
    var tarea = document.forms[form][which];
    
    document.getElementById(which).style.height = 15*(countTAlines(tarea.value,tarea.cols) )+"px";
    
    tarea_timer = setTimeout("tarea_resize('"+form+"','"+which+"');", 300);
}


