//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
/*
* Aether javascript collection
*/

function doOnload(func){
  var oldOnload = window.onload;

	if (typeof(window.onload) != "function")
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			oldOnload();
			func();
		}
	}
}


function submitForm( formid ){  
  $(formid).onsubmit();
  $(formid).submit();   
}

function onloadFocus(elementId){
  doOnload(function(){$(elementId).focus();});
}

function clearIfDefault ($obj,$value)
{
  if ($obj.value == $value)
  {
    $obj.value = '';
  }
}

function restoreIfDefault ($obj,$value)
{
  if ($obj.value == '')
  {
    $obj.value = $value;
  }
}
function clearIfDefaultPassword ($obj,$value)
{
  if ($obj.value == $value)
  {
    var id = $obj.id;
    $obj.value = '';
    var newInput = $obj.cloneNode(true);
    newInput.type = 'password';
    $obj.parentNode.replaceChild(newInput,$obj);
    setTimeout(function(){$(id).focus();}, 200);
  }
}

/**
 * breaks up the contents of a span in segments.
 * The default break token is '[nextpage]'.
 * The first segment is shown and the others can be reached by clicking a link.
 * This link is automatically inserted below the text.
 */    
 
function breakUpContents (textPrevious, textNext, elements){
  // create global arrays that hold segment-info
  window.break_up_contents_segments = new Hash();
  window.break_up_contents_segments_total = new Hash();
  
  window.break_up_contents_previous_display_text = textPrevious;
  window.break_up_contents_next_display_text = textNext;
    
  for (var i = 0; i < elements.length; i++){
    breakUpElement(elements[i]);
  };
   
}
 
function breakUpElement (elementId){
  var container = $(elementId);
  var completeContent = container.innerHTML;
  
  // the widgeditor probably has wrapped the [nextpage] with a paragraph,
  // remove it.
  var completeContent = completeContent.gsub(/<p([^<]*?)>\[nextpage\]<\/p>/i, '[nextpage]'); 
  
  //alert (completeContent);
  
  var segments = [];
  segments = completeContent.split("[nextpage]");
  //completeContent.scan(/(.*)(\[nextpage\])/i, function(match){ segments.push(match[1])});
  
  
  // store number of segments in global var
  window.break_up_contents_segments_total[elementId] = segments.length;
  // store segments in global var
  window.break_up_contents_segments[elementId] = segments;
  
  if (segments.length > 0){
    showBreakUpSegment(elementId, 0);
  }  
}

function getBreakUpNavigationBar (elementId, segmentIndex, showPrevious, showNext){
  var navTable = '<table width="100%" border="0"><tr><td class="aether_break_up_previous">';
  if (showPrevious){
    navTable += '<a href="javascript:window.showBreakUpSegment(\'' + elementId + '\', ' + (segmentIndex-1) +')">' + window.break_up_contents_previous_display_text + '</a>';
  }
  navTable += '</td><td class="aether_break_up_next">';
  if (showNext){
    navTable += '<a href="javascript:window.showBreakUpSegment(\'' + elementId + '\', ' + (segmentIndex+1) +')">' + window.break_up_contents_next_display_text + '</a>';
  }
  navTable += '</td></tr></table>';
  
  return navTable;
}

function showBreakUpSegment(elementId, segmentIndex){
  var container = $(elementId);
  var newContent = window.break_up_contents_segments[elementId][segmentIndex];
  
  var showPrevious  = segmentIndex >= 1;
  var showNext      = segmentIndex < window.break_up_contents_segments_total[elementId]-1;
  var navTable      = getBreakUpNavigationBar (elementId, segmentIndex, showPrevious, showNext);
  
  newContent += navTable;
  container.update(newContent);  
}

function autoLightbox()
{
  var anchors = document.getElementsByTagName("a");
  var imgex = /\.(jpg|jpeg|gif|png|bmp)$/;
  for (var i = 0; i < anchors.length; i++){
    var anchor = anchors[i];
    if(window.console)
      console.log(anchor);
    if (  anchor.getAttribute('href') && 
          anchor.getAttribute('href').toLowerCase().search(imgex) >= 0 &&
          !anchor.getAttribute('rel') 
        ){
      anchor.setAttribute('rel', 'lightbox');
      
    }
  }
}


function initLightboxFromFlashLink(id) {
  var objLink = $(id);
  Lightbox.prototype.start(objLink);
}

/**
 * returns the value of the selected radio in a group
 */  
function getRadioValue(formId, radioName)
{
  var buttons = $(formId).getInputs('radio', radioName);
  var selectedValue = null;
  for (var i = 0; i < buttons.length; i++)
  {
    var val = buttons[i].getValue();
    if (val != null) selectedValue = val;
    break;
  } 

  return val;  
}

/**
 * load this function on pageload and all external links will be redirected
 * to a new window
 */  
function externalLinksInBlankWin(){
	var hostname = window.location.hostname;
	hostname = hostname.replace("www.","").toLowerCase();
	var a = document.getElementsByTagName("a");	
	var check = function(obj){
		var href = obj.href.toLowerCase();
		return (href.indexOf("http://")!=-1 && href.indexOf(hostname)==-1) ? true : false;				
	};
	var set = function(obj){
		obj.target = "_blank";
	};	
	for (var i=0;i<a.length;i++){
		if(check(a[i])) set(a[i]);
	};		
}


/**
 * set a cookie value
 */
 function setCookie( name, value, expiresDays, path, domain, secure ) 
{
  // set time, it's in milliseconds
  var today = new Date();
  today.setTime( today.getTime() );
  
  /*
  if the expires variable is set, make the correct 
  expires time, the current script below will set 
  it for x number of days, to make it for hours, 
  delete * 24, for minutes, delete * 60 * 24
  */
  if ( expiresDays )
  {
    expires = expiresDays * 1000 * 60 * 60 * 24;
  }
  var expires_date = new Date( today.getTime() + (expires) );
  
  document.cookie = name + "=" +escape( value ) +
  ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
  ( ( path ) ? ";path=" + path : "" ) + 
  ( ( domain ) ? ";domain=" + domain : "" ) +
  ( ( secure ) ? ";secure" : "" );
} 

/**
 * Get a cookie value
 * Taken from http://techpatterns.com/downloads/javascript_cookies.php 
 */

function getCookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );
		
		
		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
	
		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

/**
 * delete a cookie
 */ 
function deleteCookie( name, path, domain ) {
  if ( getCokie( name ) ) document.cookie = name + "=" +
  ( ( path ) ? ";path=" + path : "") +
  ( ( domain ) ? ";domain=" + domain : "" ) +
  ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
/**
* Function to validate forms using AJAX requests
* Wouter van Koppen, wouter.vankoppen@marsmedia.nl
* 12 sept 07
*/
function verifyForm ($oForm, $sAjaxWrapperURL, $bPrefixFieldInErrorMessages, $bDebug, $sErrorClassName)
{
  // Set default params
  if ($sErrorClassName == null) {
    $sErrorClassName = 'error';
  }

  if ($bDebug == null) {
    $bDebug = false;
  }

  if ($bPrefixFieldInErrorMessages == null){
    $bPrefixFieldInErrorMessages = false;
  }
  
  // Part to make sure widgeditor content will be submitted
   if ($oForm.onsubmit)
      $oForm.onsubmit();
  window.iserror = 0;
  $sCheck = '';
  //Piet 18-1-2008 1:16:41
  // before serializing, make sure all disabled inputs are enabled again
  $oForm.getInputs().invoke('enable');
  $sCheck = $oForm.serialize(true);
  var $bError = false;
  var $sDebugging = '';

  if ($bDebug){
    alert ('Ready to make a request to "' + $sAjaxWrapperURL + '" with the following data: "' + $sCheck + '"');
  }

  new Ajax.Request($sAjaxWrapperURL,
  {
    method:'post',
    parameters: $sCheck,
    onSuccess: function(transport){
      var $sResponse = transport.responseText || "No response text";
      if ($bDebug){
        alert("Success! Received response:\n\n" + $sResponse);
      }
      $aResponse = $sResponse.evalJSON();
      $aResponseHash = $H($aResponse);

      $aResponseHash.each(function($aElement){
          if ($aElement.value != '')
          {
            // There is an error in the response for this field.
            window.iserror = 1;
            
            if ($($aElement.key)){
              $($aElement.key).addClassName($sErrorClassName);
            }else
            {
              $sDebugging = $sDebugging + 'ERR - Input holder (div) with id "' + $aElement.key + '" is not found!' + "\n";
              window.alert($sDebugging);
			}
            // Check for field existence in the document. If we don't do this, the script will hang.
            if ($('error_message_' + $aElement.key))  
            {
              
              // Do we want a prefix that can identify the field in front of the error messages?
              if ($bPrefixFieldInErrorMessages)
              {
                $('error_message_' + $aElement.key).innerHTML =  $('description_' + $aElement.key).innerHTML + ': ' + $aElement.value;
              }
              else
              {
                $('error_message_' + $aElement.key).innerHTML =  $aElement.value;
              }
            }
          
          }
          else
          {
            // This field has no error!
            
            // Check for field existence in the document. If we don't do this, the script will hang.
            if ($($aElement.key))
            {
              $($aElement.key).removeClassName($sErrorClassName);
            }
            
            // Check for field existence in the document. If we don't do this, the script will hang.
            if ($('error_message_' + $aElement.key))
            {
              $('error_message_' + $aElement.key).innerHTML = '';
            }
           
          }

        
      });
      if ($bDebug)
      {
          alert ('Done.. ' + "\n" + $sDebugging);
      }
      if (window.iserror != 1)
      {  
        $oForm.submit();    
      	return true;     
      }
      // set a general error message if found
      else{
        if ($('error_message_general')){
          $('error_message_general').innerHTML =  'Niet alle gegevens zijn correct.';
        }     
      }
      
      return false;
  

    },
    onFailure: function(){ alert('Something went wrong during the form validation process!'); }
  }

  );
  
}



function profile_updateCity (fieldname, prefix)
{
	
	 $bDebug = true;
	 
	 $sUrl = 'index.php?page=renaultdb&action=get_city&actiontype=ajax&postalcode=' + $(prefix + '_zipcode').value + '&homenumber='+ $(prefix + '_housenumber').value;
	  new Ajax.Request($sUrl ,
	  {
	    method:'get',
	    onSuccess: function(transport){
		  
		  var $sResponse = transport.responseText || "PLAATS niet gevonden";
		  
		  $(fieldname).value = $sResponse;
	      
	      return false;
	
	    },
	    onFailure: function(){ }
	  
	    }
	
	  );
}


function profile_updateByPostalcode (street, city, prefix)
{ 
	 if($(prefix + '_zipcode').value == "" || $(prefix + '_housenumber').value == "" || $(prefix + '_country').value != "Netherlands") { 
		 return false; }
	 	 	
	 $bDebug = true;
	 
	 $sUrl = 'index.php?page=renaultdb&action=get_street&actiontype=ajax&postalcode=' + $(prefix + '_zipcode').value + '&homenumber='+ $(prefix + '_housenumber').value;
	  new Ajax.Request($sUrl ,
	  {
	    method:'get',
	    onSuccess: function(transport){
		  
		  var $sResponse = transport.responseText || "STRAAT niet gevonden";
	
		  $(street).value = $sResponse;
		  
		//  profile_updateCity(city, prefix);
		
	      return false;
	
	    },
	    onFailure: function(){ }
	  
	    }
	
	  );
}

function profile_updatecityByPostalcode (street, city, prefix)
{ 
	 if($(prefix + '_zipcode').value == "" || $(prefix + '_housenumber').value == "" || $(prefix + '_country').value != "Netherlands") { 
		 return false; }
	 	 	
	 $bDebug = true;
	 
	 $sUrl = 'index.php?page=renaultdb&action=get_city&actiontype=ajax&postalcode=' + $(prefix + '_zipcode').value + '&homenumber='+ $(prefix + '_housenumber').value;
	  new Ajax.Request($sUrl ,
	  {
	    method:'get',
	    onSuccess: function(transport){
		  
		  var $sResponse = transport.responseText || "STRAAT niet gevonden";
	
		  $(city).value = $sResponse;
		  
		  //profile_updateCity(city, prefix);
		
	      return false;
	
	    },
	    onFailure: function(){ }
	  
	    }
	
	  );
}
  
function updateCity (fieldname, prefix)
{
	 $bDebug = true;
	 
	 $sUrl = 'index.php?page=renaultdb&action=get_city&actiontype=ajax&postalcode=' + $(prefix + '_postalcode').value + '&homenumber='+ $(prefix + '_homenumber1').value;
	  new Ajax.Request($sUrl ,
	  {
	    method:'get',
	    onSuccess: function(transport){
		  
		  var $sResponse = transport.responseText || "PLAATS niet gevonden";
		  
		  $(fieldname).value = $sResponse;
	      
	      return false;
	
	    },
	    onFailure: function(){ }
	  
	    }
	
	  );
}


function updateByPostalcode (street, city, prefix)
{
	 if($(prefix + '_postalcode').value == "" || $(prefix + '_homenumber1').value == "" || $(prefix + '_country').value != "Netherlands") { 
		 return false;
	 }
	 	 	
	 $bDebug = true;
	 
	 $sUrl = 'index.php?page=renaultdb&action=get_street&actiontype=ajax&postalcode=' + $(prefix + '_postalcode').value + '&homenumber='+ $(prefix + '_homenumber1').value;
	  new Ajax.Request($sUrl ,
	  {
	    method:'get',
	    onSuccess: function(transport){
		  
		  var $sResponse = transport.responseText || "STRAAT niet gevonden";
	
		  $(street).value = $sResponse;
		  
		  updateCity(city, prefix);
		
	      return false;
	
	    },
	    onFailure: function(){ }
	  
	    }
	  );
}
  
  
function updateDealer()
{
	

	 if($('city').value == "") { return false; }
	 	
 // $('ajaxLoader').show();
	 
 
 $bDebug = true;
 //$sUrl = 'index.php?page=countdownsearch&action=address&actiontype=ajax&id=' + $('store').value;
 $sUrl = 'index.php?page=renaultdb&action=get_dealer&actiontype=ajax&plaatsname=' + $('city').value;
 
 
 
  new Ajax.Request($sUrl ,
  {
    method:'get',
    onSuccess: function(transport){
      var $sResponse = transport.responseText || "No response text";
     

    //  $('ajaxLoader').hide();
	  
	  
   	  if($('dealer').outerHTML)
   	  {
    	$sResponse = '<select class="select" name="dealer" id="dealer" style="width:200px"> ' + $sResponse + ' </select>' ;
    	$('dealer').outerHTML = $sResponse;
      
      } else {
    	$('dealer').innerHTML = $sResponse;
      }
   	  
      return false;
  

    },
    onFailure: function(){ }
  
    }

  );
  
}if(typeof com == "undefined") var com = new Object();
if(typeof com.deconcept == "undefined") com.deconcept = new Object();
if(typeof com.deconcept.util == "undefined") com.deconcept.util = new Object();
if(typeof com.deconcept.FlashObjectUtil == "undefined") com.deconcept.FlashObjectUtil = new Object();
com.deconcept.FlashObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){
  if (!document.createElement || !document.getElementById) return;
  this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
  this.skipDetect = com.deconcept.util.getRequestParameter(this.DETECT_KEY);
  this.params = new Object();
  this.variables = new Object();
  this.attributes = new Array();
  this.useExpressInstall = useExpressInstall;

  if(swf) this.setAttribute('swf', swf);
  if(id) this.setAttribute('id', id);
  if(w) this.setAttribute('width', w);
  if(h) this.setAttribute('height', h);
  if(ver) this.setAttribute('version', new com.deconcept.PlayerVersion(ver.toString().split(".")));
  this.installedVer = com.deconcept.FlashObjectUtil.getPlayerVersion(this.getAttribute('version'), useExpressInstall);
  if(c) this.addParam('bgcolor', c);
  var q = quality ? quality : 'high';
  this.addParam('quality', q);
  var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
  this.setAttribute('xiRedirectUrl', xir);
  this.setAttribute('redirectUrl', '');
  if(redirectUrl) this.setAttribute('redirectUrl', redirectUrl);
}
com.deconcept.FlashObject.prototype = {
  setAttribute: function(name, value){
    this.attributes[name] = value;
  },
  getAttribute: function(name){
    return this.attributes[name];
  },
  addParam: function(name, value){
    this.params[name] = value;
  },
  getParams: function(){
    return this.params;
  },
  addVariable: function(name, value){
    this.variables[name] = value;
  },
  getVariable: function(name){
    return this.variables[name];
  },
  getVariables: function(){
    return this.variables;
  },
  createParamTag: function(n, v){
    var p = document.createElement('param');
    p.setAttribute('name', n);
    p.setAttribute('value', v);
    return p;
  },
  getVariablePairs: function(){
    var variablePairs = new Array();
    var key;
    var variables = this.getVariables();
    for(key in variables){
      variablePairs.push(key +"="+ variables[key]);
    }
    return variablePairs;
  },
  getFlashHTML: function() {
    var flashNode = "";
    if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
      if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "PlugIn");
      flashNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
      flashNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
      var params = this.getParams();
       for(var key in params){ flashNode += [key] +'="'+ params[key] +'" '; }
      var pairs = this.getVariablePairs().join("&");
       if (pairs.length > 0){ flashNode += 'flashvars="'+ pairs +'"'; }
      flashNode += '/>';
    } else { // PC IE
      if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "ActiveX");
      flashNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
      flashNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
      var params = this.getParams();
      for(var key in params) {
       flashNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
      }
      var pairs = this.getVariablePairs().join("&");
      if(pairs.length > 0) {flashNode += '<param name="flashvars" value="'+ pairs +'" />';}
      flashNode += "</object>";
    }
    return flashNode;
  },
  write: function(elementId){
    if(this.useExpressInstall) {
     
      var expressInstallReqVer = new com.deconcept.PlayerVersion([6,0,65]);
      if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
        this.setAttribute('doExpressInstall', true);
        this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
        document.title = document.title.slice(0, 47) + " - Flash Player Installation";
        this.addVariable("MMdoctitle", document.title);
      }
    } else {
      this.setAttribute('doExpressInstall', false);
    }
    if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
      var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
      n.innerHTML = this.getFlashHTML();
    }else{
      if(this.getAttribute('redirectUrl') != "") {
        document.location.replace(this.getAttribute('redirectUrl'));
      }
    }
  }
}


com.deconcept.FlashObjectUtil.getPlayerVersion = function(reqVer, xiInstall){
  var PlayerVersion = new com.deconcept.PlayerVersion(0,0,0);
  if(navigator.plugins && navigator.mimeTypes.length){
    var x = navigator.plugins["Shockwave Flash"];
    if(x && x.description) {
      PlayerVersion = new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
    }
  }else{
    try{
      var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
      for (var i=3; axo!=null; i++) {
        axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
        PlayerVersion = new com.deconcept.PlayerVersion([i,0,0]);
      }
    }catch(e){}
    if (reqVer && PlayerVersion.major > reqVer.major) return PlayerVersion; 
    if (!reqVer || ((reqVer.minor != 0 || reqVer.rev != 0) && PlayerVersion.major == reqVer.major) || PlayerVersion.major != 6 || xiInstall) {
      try{
        PlayerVersion = new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
      }catch(e){}
    }
  }
  return PlayerVersion;
}
com.deconcept.PlayerVersion = function(arrVersion){
  this.major = parseInt(arrVersion[0]) || 0;
  this.minor = parseInt(arrVersion[1]) || 0;
  this.rev = parseInt(arrVersion[2]) || 0;
}
com.deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
  if(this.major < fv.major) return false;
  if(this.major > fv.major) return true;
  if(this.minor < fv.minor) return false;
  if(this.minor > fv.minor) return true;
  if(this.rev < fv.rev) return false;
  return true;
}

com.deconcept.util = {
  getRequestParameter: function(param){
    var q = document.location.search || document.location.hash;
    if(q){
      var startIndex = q.indexOf(param +"=");
      var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
      if (q.length > 1 && startIndex > -1) {
        return q.substring(q.indexOf("=", startIndex)+1, endIndex);
      }
    }
    return "";
  }
}


if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}


var getQueryParamValue = com.deconcept.util.getRequestParameter;
var FlashObject = com.deconcept.FlashObject;

function updatePlaats ()
{

 if($('province').value == "") { return false; }
 	
 //$('ajaxLoader').show();
 
 $bDebug = true;
 //$sUrl = 'index.php?page=countdownsearch&action=address&actiontype=ajax&id=' + $('store').value;
 $sUrl = 'index.php?page=renaultdb&action=get_plaats&actiontype=ajax&provinceid=' + $('province').value;
  new Ajax.Request($sUrl ,
  {
    method:'get',
    onSuccess: function(transport){
	  
	  var $sResponse = transport.responseText || "No response text";

	  
	  
	  $('dealer').innerHTML = "";
	  
   	  if($('city').outerHTML)
   	  {
    	$sResponse = '<select class="select" name="city" id="city" style="width:200px" onChange="updateDealer()";> ' + $sResponse + ' </select>' ;
    	$('city').outerHTML = $sResponse;
      
      } else {
    	$('city').innerHTML = $sResponse;
      }
      
   	  // $('ajaxLoader').hide();
      
      return false;
  

    },
    onFailure: function(){ }
  
    }

  );
  
}
function showHideGeopend()
{
	var numericID = this.id.replace(/[^\d]/g,'');
	var obj = document.getElementById('a' + numericID);
	if(obj.style.display=='block'){
		obj.style.display='none';
	}else{
		obj.style.display='block';
	}		
}


function initShowHideContent()
{
	var divs = document.getElementsByTagName('DIV');
	for(var no=0;no<divs.length;no++){
		if(divs[no].className=='open'){
			divs[no].onclick = showHideGeopend;
		}	
		
	}	
}

window.onload = initShowHideContent;
/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();