
	window.onresize = switchPosition;
	window.onload = setPositioningOnLoad;
    
    window.size = function()
    {
    	var w = 0;
    	var h = 0;
    
    	//IE
    	if(!window.innerWidth)
    	{
    		//strict mode
    		if(!(document.documentElement.clientWidth == 0))
    		{
    			w = document.documentElement.clientWidth;
    			h = document.documentElement.clientHeight;
    		}
    		//quirks mode
    		else
    		{
    			w = document.body.clientWidth;
    			h = document.body.clientHeight;
    		}
    	}
    	//w3c
    	else
    	{
    		w = window.innerWidth;
    		h = window.innerHeight;
    	}
    	return {width:w,height:h};
    }

    function setPositioningOnLoad()
    {
        if (window.size().height < 500 || window.size().width < 980)
		{
			document.getElementById('leftdiv').style.position = 'absolute';
			document.getElementById('rightdiv').style.position = 'absolute';
		}
    }

	function switchPosition()
	{         
    	if (window.size().height < 500 || window.size().width < 980)
		{
			document.getElementById('leftdiv').style.position = 'absolute';
			document.getElementById('rightdiv').style.position = 'absolute';
		}
		else
		{
			document.getElementById('leftdiv').style.position = 'fixed';
			document.getElementById('rightdiv').style.position = 'fixed';
		}
    }
	
	window.addEvent('domready', function(){
		var box = new multiBox('mb', {
			overlay: new overlay(),
            contentColor: '#FFFFFF',
            descClassName: 'multiBoxDesc' 
		});
        
        var box2 = new multiBox('tpk', {
			overlay: new overlay(),
            contentColor: '#FFFFFF',
            descClassName: 'multiBoxDesc'
		});
	});

    function showpreview(pic, comment, elem)
    {    
        var newheight = 200;
        
        $j('#shadowdiv').fadeOut(200, function() {

        document.getElementById('previewpicture').src = 'preview-' + comment + '--' + pic + '.jpg';      
        
        var img = document.getElementById('previewpicture');
        
        var thumb = jQuery(elem);
        document.getElementById('shadowdiv').style.left = (thumb.offset().left + 105) + 'px';
        document.getElementById('shadowdiv').style.top = (thumb.offset().top - 125) + 'px';
        
        $j('#previewpicture').load(function() 
        { 
            if (!$j.browser.opera) newheight = $j('#previewpicture').height();
            document.getElementById('lefts').style.height = newheight + 'px';
            document.getElementById('rights').style.height = newheight + 'px';                    
        } );
        
        if ($j.browser.msie) $j('#previewpicture').stop(true,true).fadeIn(600);        
        $j('#shadowdiv').fadeIn(600); 

		showtip('Klick für Diashow', elem, 5) 
        });
    }
    
	function removePreview()
    {
        $j('#shadowdiv').stop(true,true).fadeOut(200); 
        if ($j.browser.msie) jQuery(document.getElementById('previewpicture')).stop(true,true).fadeOut(600);
		hidetip();
    }
	
	
    function showtip(text, elem)
    {
        var st = document.getElementById('specialtip');
        st.innerHTML = text;
        $j('#specialtip').stop(true,true).fadeIn(600); 
        //st.style.display = 'block';
        var wo = findPos(elem);        
		if (arguments.length == 3)
		{
			st.style.left = (wo[0]-arguments[2]) + 'px';
			st.style.top = (wo[1]-28) + 'px';			
		}
		else
		{
			st.style.left = (wo[0]+20) + 'px';
			st.style.top = (wo[1]-25) + 'px';
		}
    }
    
    function hidetip()
    {
        $j('#specialtip').stop(false,true).fadeOut(100); 
    }
    
        
       
    function findPos(obj) 
    {
        var curleft = curtop = 0;
        if (obj.offsetParent) 
        {    
            do 
            {
        		curleft += obj.offsetLeft;
        		curtop += obj.offsetTop;
            
            } while (obj = obj.offsetParent);       
        }
        return [curleft,curtop];
    }
    
    
    function validate_form(sender)
	{
	    valid = true;
	    var el = sender.elements;
		for(i=0; i<el.length; i++)
        {            
            if (el[i].nodeName == 'INPUT')
            {
                if (el[i].getAttribute('requiredField') != null)
                {
                    if (el[i].value.length == 0)
                    {
                        alert('Feld ' + el[i].title + ' darf nicht leer sein');
					    el[i].style.backgroundColor = '#FF0000';
                        el[i].style.color = '#FFFFFF';
					    return false;
                    }
                }
            }
        }
        return true;
	}
	
	function openContact()
	{
		var contactText = '<span class="headline_upper">Haben Sie Fragen, Anregungen, oder möchten Sie eine Reise buchen?</span><p>Rufen Sie uns an, oder schreiben Sie uns eine eMail:<br><a href="mailto:info@omneia.de">info@omneia.de</a><br>Telefon: +49 (221) 80 13 45 16<br>Mobil: +49 (151) 27 01 98 49</p>               <p><a href="kontakt.php">Weitere Kontaktmöglichkeiten...</a></p>';
		if (document.getElementById('kontakt').innerHTML.length < 250) document.getElementById('kontakt').innerHTML += contactText;		
		document.getElementById('kontakt').style.display = 'block';
		
	}
	
	function clearsb(sb)
    {
        if (sb.value == 'suchen...')
            sb.value = '';
        else 
        {
            sb.focus();
            sb.select();
        }
    }
    
    
    
    
  
    

