function Cookiemanager(name,defaultExpiration,expirationUnits,defaultDomain,defaultPath) {
	this.name = name;
	this.defaultExpiration = this.getExpiration(defaultExpiration,expirationUnits);
	this.defaultDomain = (defaultDomain)?defaultDomain:(document.domain.search(/[a-zA-Z]/) == -1)?document.domain:document.domain.substring(document.domain.indexOf('.') + 1,document.domain.length);
	this.defaultPath = (defaultPath)?defaultPath:'/';
	this.cookies = new Object();
	this.expiration = new Object();
	this.domain = new Object();
	this.path = new Object();
	window.onunload = new Function (this.name+'.setDocumentCookies();');
	this.getDocumentCookies();
	}
Cookiemanager.prototype.getExpiration = function(expiration,units) {
	expiration = (expiration)?expiration:7;
	units = (units)?units:'days';
	var date = new Date();
	switch(units) {
		case 'years':
			date.setFullYear(date.getFullYear() + expiration);
			break;
		case 'months':
			date.setMonth(date.getMonth() + expiration);
			break;
		case 'days':
			date.setTime(date.getTime()+(expiration*24*60*60*1000));
			break;
		case 'hours':
			date.setTime(date.getTime()+(expiration*60*60*1000));
			break;
		case 'minutes':
			date.setTime(date.getTime()+(expiration*60*1000));
			break;
		case 'seconds':
			date.setTime(date.getTime()+(expiration*1000));
			break;
		default:
			date.setTime(date.getTime()+expiration);
			break;
		}
	return date.toGMTString();
	}
Cookiemanager.prototype.getDocumentCookies = function() {
	var cookie,pair;
	var cookies = document.cookie.split(';');
	var len = cookies.length;
	for(var i=0;i < len;i++) {
		cookie = cookies[i];
		while (cookie.charAt(0)==' ') cookie = cookie.substring(1,cookie.length);
		pair = cookie.split('=');
		this.cookies[pair[0]] = pair[1];
		}
	}
Cookiemanager.prototype.setDocumentCookies = function() {
	var expires = '';
	var cookies = '';
	var domain = '';
	var path = '';
	for(var name in this.cookies) {
		expires = (this.expiration[name])?this.expiration[name]:this.defaultExpiration;
		path = (this.path[name])?this.path[name]:this.defaultPath;
		domain = (this.domain[name])?this.domain[name]:this.defaultDomain;
		cookies = name + '=' + this.cookies[name] + '; expires=' + expires + '; path=' + path + '; domain=' + domain;
		document.cookie = cookies;
		}
	return true;
	}
Cookiemanager.prototype.getCookie = function(cookieName) {
	var cookie = this.cookies[cookieName]
	return (cookie)?cookie:false;
	}
Cookiemanager.prototype.setCookie = function(cookieName,cookieValue,expiration,expirationUnits,domain,path) {
	this.cookies[cookieName] = cookieValue;
	if (expiration) this.expiration[cookieName] = this.getExpiration(expiration,expirationUnits);
	if (domain) this.domain[cookieName] = domain;
	if (path) this.path[cookieName] = path;
	return true;
	}
var cookieManager = new Cookiemanager('cookieManager',1,'years');


var selected;
var submitter = null;

function submitFunction() {
    submitter = 1;
}
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}  

function selectRowEffect(object, buttonSelect) {
  if (!selected) {
    if (document.getElementById) {
      selected = document.getElementById('defaultSelected');
    } else {
      selected = document.all['defaultSelected'];
    }
  }

  if (selected) selected.className = 'moduleRow';
  object.className = 'moduleRowSelected';
  selected = object;
  
// one button is not an array
  if (document.getElementsByName("payment")[0]) {
    document.getElementsByName("payment")[buttonSelect].checked = true;
  } else {
    //document.getElementsByName("payment")[selected].checked=true;
  }

// one button is not an array
  if (document.getElementsByName("address")[0]) {
    document.getElementsByName("address")[buttonSelect].checked = true;
  } else {
    //document.getElementsByName("address")[selected].checked=true;
  }

// one button is not an array
  if (document.getElementsByName("shipping")[0]) {
    document.getElementsByName("shipping")[buttonSelect].checked = true;
  } else {
    //document.getElementsByName("shipping")[selected].checked=true;
  }
}


function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}

function popupImageWindow(url) {
  window.open(url,'popupImageWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}


PopUp = function(autoapply){
	this.types = [];
	this.defaults = {
		width:800,
		height:600,
		top:0,
		left:0,
		location:false,
		resizable:false,
		scrollbars:false,
		status:false,
		toolbar:false,
		menubar:false,
		center:true,
		title:"Dieser Link wird in einem neuen Fenster geoeffnet"
	}
	this.addType({
		name:"standard",
		location:true,
		resizable:true,
		scrollbars:true,
		status:true,
		toolbar:true,
		menubar:true
	});
	if(autoapply) this.apply();
}
o = PopUp.prototype;
o.apply = function(){
	var links = document.getElementsByTagName("a");
	if(!links) return;
	for(var i=0;i<links.length;i++){
		var l = links[i];
		if(l.className.indexOf("popup") > -1){
			this.attachBehavior(l,this.getType(l));
		}
	}
}
o.addType = function(type){
	for(var prop in this.defaults){
		if(type[prop] == undefined) type[prop] = this.defaults[prop];
	}
	this.types[type.name] = type;
}
o.getType = function(l){
	for(var type in this.types){
		if(l.className.indexOf(type) > -1) return type;
	}
	return "standard";
}
o.attachBehavior = function(l,type){
	var t = this.types[type];
	l.title = t.title;
	l.popupProperties = {
		type: type,
		ref: this
	};
	l.onclick = function(){
		this.popupProperties.ref.open(this.href,this.popupProperties.type);
		return false;
	}
}
o.booleanToWord = function(bool){
	if(bool) return "yes";
	return "no";
}
o.getTopLeftCentered = function(typeObj){
	var t = typeObj;
	var r = {left:t.left, top:t.top};
	var sh = screen.availHeight-20;
	var sw = screen.availWidth-10;
	if(!sh || !sw) return r;
	r.left = (sw/2)-(t.width/2);
	r.top = (sh/2)-(t.height/2);
	return r;
}
o.getParamsOfType = function(typeObj){
	var t = typeObj;
	var c = this.booleanToWord;
	if(t.center){
		var tc = this.getTopLeftCentered(typeObj);
		t.left = tc.left;
		t.top = tc.top;
	}
	var p = "width="+t.width;
	p+=",height="+t.height;
	p+=",left="+t.left;
	p+=",top="+t.top;
	p+=",location="+c(t.location);
	p+=",resizable="+c(t.resizable);
	p+=",scrollbars="+c(t.scrollbars);
	p+=",status="+c(t.status);
	p+=",toolbar="+c(t.toolbar);
	p+=",menubar="+c(t.menubar);
	return p;
}
o.open = function(url,type){
	if(!type) type = "standard";
	var t = this.types[type];
	var p = this.getParamsOfType(t);
	var w = window.open(url,t.name,p);
	if(w) w.focus();
	return false;
}
jQuery(document).ready(function(){
//--
var nuhtml = jQuery('div#frameListHead').html();		
jQuery('div#descbottom').html(nuhtml);
jQuery('div#frameListHead').html('');



	jQuery('#tradeLayer').hide();
	jQuery('#tradeAnswer').hide();
	jQuery('#tradeButton').click(function(){
		jQuery('#tradeLayer').slideDown();
		jQuery('#tradeButton').hide();	
		jQuery('#tradeFormButton').click(function(){
			if((jQuery('#productspriceplain').val()*0.7)<=jQuery('#tradeoffer').val().replace(/,/,'.'))
			{
				var emailR = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

				var Email = jQuery("#tradeemail").val();
				if(Email == '')
				{
					jQuery("#tradeemail").focus();
					jQuery("#tradeerror").text('E-Mail-Adresse fehlt. Your Email is requiered.');

				}else if(!emailR.test(Email))
				{
					jQuery("#tradeemail").focus();
					jQuery("#tradeerror").text('Die E-Mail-Adresse ist falsch. Wrong Emailformat.');

				}else
				{
					jQuery('#tradeForm').load('sendtradeoffer.php',{'name':jQuery('#tradename').val(),'lastname':jQuery('#tradelastname').val(),'email':jQuery('#tradeemail').val(),'model':jQuery('#trademodel').val(),'products_id':jQuery('#products_id').val(),'offer':jQuery('#tradeoffer').val(),'id':jQuery('div#tradeForm select option:selected').text() });
					jQuery('#tradeForm').slideUp();
					jQuery('#tradeAnswer').slideDown();
				}
			}else
			{
				jQuery('#tradeoffer').focus();
				jQuery('#tradeerror').text('Wir k&ouml;nnen leider unsere Produkte auch nicht verschenken. Bitte versuchen Sie es noch einmal. Its too cheap please try it again.');
			}
		return false;
		})	
	return false;
	});
//frameListHead
 if ( jQuery.browser.msie ) {
    jQuery(".CatLevel1 ul").hover(function(){
    	jQuery(".CatLevel1 ul").css( "display","none" );
    });
 } 


//--
});
