var posContent = Class.create();

posContent.prototype = {

	initialize: function() {
    
      	viewportwidth = document.viewport.getWidth();
      	this.cookie = this.getCookie('pos');
		
		this.checkSizes(viewportwidth);
		
       
    },
    checkSizes: function(viewportwidth){
    	
    	if(viewportwidth > 1225 && this.cookie==''){
			this.shift(225); 
			var shifclaim=225+138;
			if ($('startwrapper')!=undefined) {
				$('startwrapper').setStyle({left: shifclaim+'px'});
			}
		}
    
    },
    shift: function(shift){
    	
    	if ($('mainnav')!=undefined) {
    		$('mainnav').setStyle({left: shift+'px'});
    	}
    	if ($('subnav')!=undefined) {
    		$('subnav').setStyle({left: shift+'px'});
    	}
    	var shiftangebot=shift+12;
    	if ($('angebot')!=undefined) {
    		$('angebot').setStyle({left: shiftangebot+'px'});
    	}
    	if ($('content')!=undefined) {
    		$('content').setStyle({left: shift+'px'});
    	}
    	

		this.set_cookie('pos', 'shift',  '/');
		
    }, 
    set_cookie: function(name, value, path) {

		var today = new Date();
		var expire = new Date();
		var duration = 3600000*1;// take days off, one hour enough hzue
		expire.setTime(today.getTime() + duration);
		document.cookie = name + '=' + value + '; expires='+expire.toGMTString()+'; path=' + path + ';';
	
	}, 
	getCookie: function(c_name)
		{
		if (document.cookie.length>0)
		  {
		  c_start=document.cookie.indexOf(c_name + "=");
		  if (c_start!=-1)
			{
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
			}
		  }
		return "";
		}
 }


function initPos(){
	posContent = new posContent();
	
}

Event.observe(window, 'load', initPos, false);
