iframe=function(id){
	this.iframe=top.frames.autoscout.document;
	alert(id);
  this.loadCSS=function(uri){
  	var oLink = document.createElement("link");
  	oLink.href = uri;
  	oLink.rel = "stylesheet";
  	oLink.type = "text/css";
  	
		var test = document.createTextNode('Hallo Welt');
		
		//alert(this.iframe.body.innerHTML);	
  	this.iframe.body.appendChild(oLink);
		//this.iframe.body.appendChild(test);
  }
	return this;
}

function zoomPlayerIn(){
	//$('area-TopPanel').style.height='426px';
	document.getElementById('area-TopPanel').style.height='426px';
}
function zoomPlayerOut(){
	//$('area-TopPanel').style.height='230px';
	document.getElementById('area-TopPanel').style.height='230px';
}

function smartconfigurator(mid)
{
w=910;
h=700;
country = 'CH';
country=country.toUpperCase();
language = 'de';
ccUrl = 'http://www.smart.com/is-bin/INTERSHOP.enfinity/WFS/mpc-ch-content-Site/de_CH/-/CHF/Smart_ViewCarConfigurator-Start';
//ccUrl =ccUrl, 'modelcode=' + mid;
window.open(ccUrl,'smartconf','width='+w+',height='+h+',locationbar=no,toolbar=no,scrollbars=yes,left='+(Math.round((screen.width-w)/2))+',top='+(Math.round((screen.height-h)/2))+ ',toolbar=no');
}


function enlargeGalleryImage(uri){
	new Asset.image(uri, {id: 'myImage', title: '', onload: function(){ 
		$('gallery-big').effect('height',{transition:Fx.Transitions.Quad.easeInOut, duration: 500}).start($('gallery-big-image').getFirst().getSize()['size']['y'] ); 
	} }).injectInside($('gallery-big-image').empty());return false;
}

function popup(url,options) {
  options=options || {};
	var width=options.width || 450;
	var height=options.height || 350;
	
  fenster=window.open(url, "Popupfenster", "width="+width+",height="+height+",resizable=no");
  fenster.focus();
}

var invalid={};

function validateInput(field,regex){
	if(!field.value.match(regex)){
  	setInvalid(field);
  }else{
  	setValid(field);
  }
}
function setValid(field){
	field.className="valid";
	invalid[field.id]=false;
	submitStat();
}
function setInvalid(field){
	field.className="invalid";
	invalid[field.id]=true;
	submitStat();
}
function submitStat(){	
  if(($$('input.valid').length) < ($$('input').length-1)){
  	$("submit").disabled=true;
  	$("submit").className="submit disabled";
  }else{
  	$("submit").disabled=false;
  	$("submit").className="submit";
  }
}