/*  
Description:	JavaScript-File - Lehniner Carnevals Verein e.V.
Version:     	1.0
Author:      	Felix Sternsdorf - http://www.ds-sternsdorf.de 

		The CSS, JavaScript, HTML, XHTML and design is released under GPL:
		http://www.opensource.org/licenses/gpl-license.php
*/

function setNews()
	{
        document.write("11.11.11 - Sandra I. und André I. schlossen den Bund zur Narrenehe. Golzow 19.11.11");
	}

 function getEmail( user, clas )
	{
        var dom = '&#108;&#99;&#118;&#45;&#108;&#101;&#104;';
	dom = dom + '&#110;&#105;&#110;&#46;&#100;&#101;';
        document.write("<a class='"+ clas + "' href='mailto:");
	document.write( user + "&#64;"+ dom +"'>");
	document.write( user + "&#64;" + dom + "</a>");
 	}
 
function copyText()
	{
     	document.write("&copy; 2007-2011 LCV Lehniner Carnevals Verein e.V. - Die beste Darstellung wird bei einer Aufl&#246;sung von 1024x768 Pixel erreicht.");
	}

function openSponsor( path )
	{
        var ref = new Array(30);
        var img = new Array(30);
        ref[0] = "www.landfoto.de";
        img[0] = "landfoto-michelsdorf.jpg";
        ref[1] = "www.weinladen-am-kloster.de"
        img[1] = "weinladen.gif";
        ref[2] = "www.der-spielbus.de";
        img[2] = "spielbus.jpg";
        ref[3] = "www.renault-weinreich.de";
        img[3] = "weinreich.gif";
        ref[4] = "www.buteo-busservice.de"
        img[4] = "buteo-busservice.jpg";
        ref[5] = "";
        img[5] = "siedler.jpg";
        ref[6] = "";
        img[6] = "strauss.jpg";
        ref[7] = "";
        img[7] = "rauhut.jpg";
        ref[8] = "";
        img[8] = "braun.gif";
        ref[9] = "";
        img[9] = "diegruen.gif";
        ref[10] = "";
        img[10] = "vgs.gif";
        ref[11] = "www.feba-bau.de";
        img[11] = "febabau.jpg";
        ref[12] = "";
        img[12] = "georg.jpg";
        ref[13] = "";
        img[13] = "kaehne.jpg";
        ref[14] = "";
        img[14] = "lahni.jpg";
        ref[15] = "www.spezialtransport-lehnin.de";
        img[15] = "mayer.jpg";
        ref[16] = "";
        img[16] = "willi.jpg";
        ref[17] = "";
        img[17] = "zillestube.gif";
        ref[18] = ""
        img[18] = "jeske.jpg";
        ref[19] = "www.das-cafe-lehnin.de";
        img[19] = "cafe-niewar.jpg";
        ref[20] = "www.druckerei-bertz.de";
        img[20] = "druckerei-bertz.jpg";
        ref[21] = "www.buteo-busservice.de"
        img[21] = "buteo-busservice.jpg";
        ref[22] = "www.weinladen-am-kloster.de"
        img[22] = "weinladen.gif";
        ref[23] = "";
        img[23] = "zillestube.gif";
        ref[24] = ""; //"www.das-cafe-lehnin.de";
        img[24] = "cafe-niewar.jpg";
        ref[25] = "www.druckerei-bertz.de";
        img[25] = "druckerei-bertz.jpg";
        ref[26] = "";
        img[26] = "lahni.jpg";
        ref[27] = "www.spezialtransport-lehnin.de";
        img[27] = "mayer.jpg";
        ref[28] = "";
        img[28] = "willi.jpg";
        ref[29] = "";
        img[29] = "georg.jpg";
  

	var jetzt = new Date();
  	var sek = ( jetzt.getSeconds() % 30);


    	if (ref[sek] )
		{
		document.write("<a href='http://" + ref[sek] + "' target='_blank'>");
		}
	document.write("<img id='bimg' src='" + path + "sponsoren/" + img[sek] );
        document.write("' alt='" + ref[sek] + "' />");
	if (ref[sek] )
		{
		document.write("</a>");
		} 
	}

function setWidth() {             // source www.quirksmode.org
	var xmax = 1400;
	var ymax = 850;
	var xmin = 750;
	var ymin = 550;
		if (self.innerHeight) // all except Explorer
		{
			self.innerWidth
			if (self.innerWidth > xmax) { window.resizeTo(xmax,ymax); }
			if (self.innerWidth < xmin) { window.resizeTo(xmin,ymin); }
		}
		else if (document.documentElement && document.documentElement.clientHeight)
			// Explorer 6 Strict Mode
		{
			if (document.documentElement.clientWidth > xmax) 		
				{ window.resizeTo(xmax,ymax); }
			if (document.documentElement.clientWidth < xmin) 		
				{ window.resizeTo(xmin,ymin); }
		}
		else if (document.body) // other Explorers
		{
			if (document.body.clientWidth > xmax) 		
				{ window.resizeTo(xmax,ymax); }
			if (document.body.clientWidth < xmin) 		
				{ window.resizeTo(xmin,ymin); }
		}
	}

function openAlbum( ref, txt, cnt, path )
	{
    	document.write("<a href='" + ref + "?c=" + cnt + "&p=" + path + "'> " + txt + " </a>"); 
	}

function initAlbum()
	{
    	var ref = window.location.href.split("?");
    	var par = ref[1].split("&");
    	var par1 = par[0].split("=");
    	var par2 = par[1].split("=");
    	var res = new Array ( par1[1], par2[1] );  //Anzahl Bilder, Pfad
	document.write("<img name='image' ");
	document.write("style='margin:5px;border:2px solid #700000;width:450px;height:400px' ");
	document.write("src='./" + par2[1] + "/img0.jpg' />");
        return res;
	}

function diastart()
{
	change('still',stillout);
	change('start',startclick);
	timeout = 3000;
	diashow();	
	activ = true;
}

function climg(a)
{
        loadimg(a);
        diastop();
}

function loadimg(a)
{
        document.image.src = img[a];
        x = a;
}

function clickcurrent()
{
        document.src = img[a];
        diastop();
}

function diaslow() 
{
	change('slow',slowclick);
	if ( activ ) {
		if ( timeout > 1000 ) 
		{
			timeout = timeout - 2000;
	        	clearTimeout(timeID);
	        	timeID = setTimeout("diashow()",timeout);
		}
	}
}

function diafast() 
{
	change('fast',fastclick);
	if ( activ ) {
		if ( timeout < 9000 ) 
		{
			timeout = timeout + 2000;
        		clearTimeout(timeID);
        		timeID = setTimeout("diashow()",timeout);
		}
	}
}

function diaexit( path )
{
	change('exit',exitclick);
	change('still',stillout);
	change('start',startout);
        clearTimeout(timeID);
    	var ref = window.location.href.split("?");
    	var par = ref[1].split("&");
    	var par2 = par[1].split("="); 
	var path = par2[1] + ".html"; //Pfad
	window.location.href = path; 
}

function diastop()
{
	change('start',startout);
	change('still',stillclick);
        clearTimeout(timeID);
	activ = false;
}

function change( imgID , newImg )
	{
        	document.getElementById( imgID ).src =  newImg.src;
	}


function set_img(m)
{
          document.write('<a href="#" onclick="clickcurrent()" src="');
          document.write(img[m]);
          document.write('" name="image" width=450 height=400></a>');
}

function diashow()
{
        if (x == cnt) { x = 0; }
        clearTimeout(timeID);
	timeID = setTimeout("diashow()",timeout);
        loadimg(x);
	x++;
	change('start',startclick);
}

function show_album(img, path, cnt)
{
    slowout.src = "../a_img/red_slow.gif";     
    slowover.src = "../a_img/green_slow.gif";
    slowclick.src = "../a_img/blue_slow.gif";

    fastout.src = "../a_img/red_fast.gif";     
    fastover.src = "../a_img/green_fast.gif";
    fastclick.src = "../a_img/blue_fast.gif";

    startout.src = "../a_img/red_start.gif";     
    startover.src = "../a_img/green_start.gif";
    startclick.src = "../a_img/blue_start.gif";

    stillout.src = "../a_img/red_pause.gif";     
    stillover.src = "../a_img/green_pause.gif";
    stillclick.src = "../a_img/blue_pause.gif";

    exitout.src = "../a_img/red_stop.gif";     
    exitover.src = "../a_img/green_stop.gif";
    exitclick.src = "../a_img/blue_stop.gif";

    document.write('<table><tr><td>');
    document.write('<button type="button" onclick="diaslow()" style="width:76px;height:66px;" ');
    document.write('onmouseover="change(\'slow\',slowover)" '); 
    document.write('onmouseout="change(\'slow\',slowout)"> ');
    document.write('<img id="slow" src="../a_img/red_slow.gif" alt="slow" /> ');
    document.write('</button></td><td> ');
    document.write('<button type="button" onclick="diafast()" style="width:76px;height:66px;" ');
    document.write('onmouseover="change(\'fast\',fastover)" ');
    document.write('onmouseout="change(\'fast\',fastout)"> ');
    document.write('<img id="fast" src="../a_img/red_fast.gif" alt="fast" /> ');
    document.write('</button></td><td> ');
    document.write('<button type="button" onclick="diastart()" style="width:76px;height:66px;" ');
    document.write('onmouseover="if(!activ){change(\'start\',startover)}" '); 
    document.write('onmouseout="if(!activ){change(\'start\',startout)}"> ');
    document.write('<img id="start" src="../a_img/red_start.gif" alt="start" /> ');
    document.write('</button></td><td> ');
    document.write('<button type="button" onclick="diastop()" style="width:76px;height:66px;" ');
    document.write('onmouseover="if(activ){change(\'still\',stillover)}" '); 
    document.write('onmouseout="if(activ){change(\'still\',stillout)}"> ');
    document.write('<img id="still" src="../a_img/red_pause.gif" alt="still" /> ');
    document.write('</button></td><td> ');
    document.write("<button type='button' onclick='diaexit()' style='width:76px;height:66px;' ");
    document.write('onmouseover="change(\'exit\',exitover)" '); 
    document.write('onmouseout="change(\'exit\',exitout)"> ');
    document.write('<img id="exit" src="../a_img/red_stop.gif" alt="exit" /> ');
    document.write('</button></td></tr></table> '); 


        var i = 0;
        document.write('<table><tr>');
	for (i = 0; i < cnt; i++) 
        {
              img[i] = path + "/img" + i + ".jpg";

	      document.write('<td><a href="#" onclick="climg(');
              document.write(i);
              document.write(')"><img SRC="');
              document.write(img[i]);
              document.write('" NAME="img');
              document.write(i);
              document.write('" alt=""');
              document.write(' height="64" width="72" border="2">');
              document.write('</a></td>');

              if (i == 4) document.write('<tr></tr>');
              if (i == 9) document.write('<tr></tr>');
              if (i == 14) document.write('<tr></tr>');
              if (i == 19) document.write('<tr></tr>');
              if (i == 24) document.write('<tr></tr>');
              if (i == 29) document.write('<tr></tr>');
              if (i == 34) document.write('<tr></tr>');
              if (i == 39) document.write('<tr></tr>');
              if (i == 44) document.write('<tr></tr>');
              if (i == 49) document.write('<tr></tr>');
              if (i == 54) document.write('<tr></tr>');
              if (i == 59) document.write('<tr></tr>');
              if (i == 64) document.write('<tr></tr>');
              if (i == 69) document.write('<tr></tr>');
              if (i == 74) document.write('<tr></tr>');
              if (i == 79) document.write('<tr></tr>');
              if (i == 84) document.write('<tr></tr>');
              if (i == 89) document.write('<tr></tr>');
              if (i == 94) document.write('<tr></tr>');
        }
        document.write('</tr></table>');

        setTimeout("diastart()",timeout);
}


