var SITE_ROOT = 'http://www.remiblot.com/processEmail08.php';
//var SITE_ROOT = 'http://server/oxford/';
 try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

function addDOMLoadEvent(f){if(!window.__ADLE){var n=function(){if(arguments.callee.d)return;arguments.callee.d=true;if(window.__ADLET){clearInterval(window.__ADLET);window.__ADLET=null}for(var i=0;i<window.__ADLE.length;i++){window.__ADLE[i]()}window.__ADLE=null};if(document.addEventListener)document.addEventListener("DOMContentLoaded",n,false);/*@cc_on @*//*@if (@_win32)document.write("<scr"+"ipt id=__ie_onload defer src=//0><\/scr"+"ipt>");var s=document.getElementById("__ie_onload");s.onreadystatechange=function(){if(this.readyState=="complete")n()};/*@end @*/if(/WebKit/i.test(navigator.userAgent)){window.__ADLET=setInterval(function(){if(/loaded|complete/.test(document.readyState)){n()}},10)}window.onload=n;window.__ADLE=[]}window.__ADLE.push(f)}
 
 function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
	window.onload = func;
	} else {
	window.onload = function() {
	oldonload();
	func();
	
		}
	}
 }
 
 var data1 = new Date();
 
 var fotos_array = new Array();		
		
 function path_images ()
 {
	var fotos_img= $$('.foto');
	
	 for(m=0; m<fotos_img.length; m++)
   {  
	  fotos_array[m] = fotos_img[m].getAttribute('src');
	  
	  }
	
 }
 
 function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
 
 Fx.Properties = Fx.Styles.extend({	
			increase: function(){for (	var p in this.now) this.element[p] = this.now[p];	}	
		});



		Fx.FlyingScroller = Fx.Properties.extend({
			initialize: function(el, options){
				this.parent(el, options);
				this.options = Object.extend(this.options || {}, Object.extend({
					paddingLeft: 0,
					paddingTop: 0
				}, options || {}));
			},
			toElement: function(el, paddingLeft, paddingTop){
				this.goTo(el.offsetLeft - (paddingLeft || this.options.paddingLeft || 0), el.offsetTop - (paddingTop || this.options.paddingTop || 0));
			},
			goTo: function(x, y){
				this.start({
					'scrollLeft': [this.element.scrollLeft, x],
					'scrollTop': [this.element.scrollTop, y]
				})
			}
		});

function id(id)
	{
		var elem = document.getElementById(id);
		return elem;
	}		

function close_message(link)
	{
		link.parentNode.parentNode.style.display = 'none';
	}

function contact_form(form)
	{
		var form_obj = id(form);
		/*alert(form_obj);*/
		var poststr = "name=" + form_obj._name.value
					+ "&tel=" + form_obj.tel.value
					+ "&email=" + form_obj.email.value
					+ "&message=" + form_obj.message.value
					+ "&sent=" + form_obj.sent.value
					+ "&contact=1&ajax=1"
		load_content('contact_feedback', SITE_ROOT, poststr);
		
		
	}

function set_message_contact_form(form,nm,tl,eml,msg)
	{
var form_obj = id(form);
form_obj._name.value = nm;
form_obj.tel.value = tl;
form_obj.email.value = eml;
form_obj.message.value = msg;
}
	
	
function clearForm(){
set_message_contact_form('contact_form_id','','','','');
}	
	
	
	
	
	
	
	
 function navigation ()
 { 
 
 
 
 var contents = $('contents');
   var fotos_big = $$('.foto');
   
   for(x=0; x<fotos_big.length; x++)
   {  fotos_big[x].setAttribute('src','templates/images/pix.gif');
	}
   var fotos = document.getElementById('fotos');
   var fotos_img= $$('#fotos div');
   var fotos_span = $$('#fotos span'); 
   
   var dia_3 = document.getElementById('service');
   dia_3.removeChild(fotos);
   var fotos_wrapper = document.createElement('div');
   fotos_wrapper.setAttribute('id','fotos_wrapper');
   dia_3.appendChild(fotos_wrapper);
   
   
   for(m=0; m<fotos_img.length; m++)
   {fotos_wrapper.appendChild(fotos_img[m]);
	   fotos_img[m].style.top = m*494 + 'px';
	   //fotos_img[m].removeAttribute('alt');
	  
	  }
  

   var fotos_nav2 = $('fotos_nav2');
   fotos_nav2.style.visibility = 'visible';
   fotos_nav2.style.position = 'absolute';
   fotos_nav2.style.top = -400 + 'px';
   fotos_nav2.style.left = 0+ 'px';
   fotos_nav2.style.margin = 0;
   
   var fotos_nav_h4 = document.createElement('h4');
  fotos_nav2.appendChild(fotos_nav_h4);
   fotos_nav_h4.innerHTML = fotos_span[0].innerHTML;
   
  var main_nav = new Fx.FlyingScroller($('contents_wrapper'), {
		transition: Fx.Transitions.quadInOut,
		duration: 1500,
		paddingLeft: 0,
		paddingTop: 0
	
	});
	
	 var main_nav_1 = new Fx.FlyingScroller($('contents_wrapper_1'), {
		transition: Fx.Transitions.quadInOut,
		duration: 1500,
		paddingLeft: 0,
		paddingTop: 0
	
	});
	
	
	if(location.href!="http://www.remiblot.com/#formular_contact" && location.href!="http://www.remiblot.com/#dia_0_slide_11"){
  main_nav.clearTimer().toElement($('home'));
   main_nav_1.clearTimer().toElement($('home_1'));    
   }
  
  
  var contact_nav = new Fx.FlyingScroller($('contact'), {
		transition: Fx.Transitions.quadInOut,
		duration: 1500,
		paddingLeft: 0,
		paddingTop: 0
		
	
	});
  contact_nav.clearTimer().toElement($('formular_contact'));
  
  
  var dia_4_nav = new Fx.FlyingScroller($('contents_wrapper'), {
		transition: Fx.Transitions.quadInOut,
		duration: 1500,
		paddingLeft: 0,
		paddingTop: 0
		
	
	});
	
	
	var dia_10_nav = new Fx.FlyingScroller($('contents_wrapper_1'), {
		transition: Fx.Transitions.quadInOut,
		duration: 1500,
		paddingLeft: 0,
		paddingTop: 0
		
	
	});
  
  
  
  
  
   var portrait_nav = new Fx.FlyingScroller($('dia_1'), { 
		transition: Fx.Transitions.quadInOut,
		duration: 1500,
		paddingLeft: 0,
		paddingTop: 0
		
	
	});
   
  
  
  
   var dia_0_slide_1_nav = new Fx.FlyingScroller($('dia_0'), { 
		transition: Fx.Transitions.quadInOut,
		duration: 1500,
		paddingLeft: 0,
		paddingTop: 0
		
	
	});
	
	 var dia_5_nav = new Fx.FlyingScroller($('dia_5'), { 
		transition: Fx.Transitions.quadInOut,
		duration: 1500,
		paddingLeft: 0,
		paddingTop: 0
		
	
	});
  
  
   var service_nav = new Fx.FlyingScroller($('service'), { 
		transition: Fx.Transitions.quadInOut,
		duration: 1500,
		paddingLeft: 0,
		paddingTop: 0
		
	
	});
  
  
  
  
 
   var main_nav_lks = new Array();
   var lnk_url = $$('a');
   var foto_nav2_lks = $$('#fotos_nav2 a');
   foto_nav2_lks[0].setAttribute('id','active_sel');
   var content_div =  $$('.content');
   
   for (m=0; m<lnk_url.length; m++)
   {
	 if(lnk_url[m].getAttribute('rel')=='main_menu' || lnk_url[m].getAttribute('rel')=='second_menu')
	 {
	    main_nav_lks.push(lnk_url[m]); 	 
	  }
	}
  
   for (i=0; i<main_nav_lks.length; i++)
   {
	 main_nav_lks[i].onclick = function ()
	 {      
	   var hovered = $('hovered');
		if(hovered) {hovered.removeAttribute('id');}
		if(this.className!='home') {this.setAttribute('id','hovered');}
		
		
		var target_page = $(this.className);
		if(this.getAttribute('rel')=='main_menu')
	   { 
	   main_nav.clearTimer().toElement($(target_page )); 
	    main_nav_1.clearTimer().toElement($('home_1'));
	   }
	   
	   if(this.getAttribute('rel')=='second_menu')
	   { 
	   main_nav_1.clearTimer().toElement($(target_page )); 
	    main_nav.clearTimer().toElement($('home'));
	   }
	   
	   if(this.className=='contact')
	   { 
		 contact_nav.clearTimer().toElement($('formular_contact')); 
		  
	   }
	   
	   
	   
	  
	   
	  
	  if(this.className=='home')
	   { 
	   var st = document.getElementById('info_right');
	    st.innerHTML ='&nbsp;';
	    st.style.opacity=0;
	   var _ttl = document.getElementById("_ttlhome").firstChild.nodeValue;
	   var _txt = document.getElementById("_txthome").firstChild.nodeValue;
	   var _lk_href = document.getElementById("_lkhome");
	   var _lk_value = document.getElementById("_lkhome").firstChild.nodeValue;
	    
	 
		document.getElementById('info_right').innerHTML = '<h4>'+_ttl+'</h4>'+ _txt +'<br/>';
		document.getElementById('info_right_1').innerHTML = '<h4>'+_ttl+'</h4>'+ _txt +'<br/>';

     var ah = document.createElement('a');
	 ah.setAttribute('href',_lk_href);
	 ah.innerHTML=_lk_value;
	 st.appendChild(ah);
	 
	    initImage('info_right');
	     initImage('info_right_1');
		}
	  
	   
	 
	  
		
		for(i=0; i<12; i++){
		if(this.className==dia_+i)
	   { 
		legende_1(i);
		}
		}
		

       return false;  
	  }
   }
   
   var current_foto = 0;
   
   var fotos_nav = document.createElement('ul');
   fotos_nav.setAttribute('id','fotos_nav')
   for(i=0; i<2; i++)
   { var li = document.createElement('li');
     var a = document.createElement('a');
	 a.setAttribute('href','#');
	 fotos_nav.appendChild(li);
	 li.appendChild(a);
	}
	dia_3.appendChild(fotos_nav);
	var fotos_nav_lks = fotos_nav.getElementsByTagName('a');
	fotos_nav_lks[0].setAttribute('id','prev');
	fotos_nav_lks[1].setAttribute('id','next');
	
   var prev = fotos_nav_lks[0];
   var next = fotos_nav_lks[1];
   
   prev.onclick = function () 
   { 
     if(current_foto==1) 
	 {this.style.visibility = 'hidden';}
     if(current_foto>0) 
      { current_foto--; }
	  
      var active_sel = $('active_sel');
      if(active_sel) {active_sel.removeAttribute('id');}
	  foto_nav2_lks[current_foto].setAttribute('id','active_sel');
	  next.style.visibility  = 'visible';
	
	 gal_nav.clearTimer().toElement($('foto'+(current_foto+1)));
	 fotos_nav_h4.innerHTML = fotos_span[current_foto].innerHTML;
	 return false;
   }
   
   next.onclick = function () 
   { 
     if(current_foto==foto_nav2_lks.length-2) 
	 {this.style.visibility = 'hidden';}
     if(current_foto<foto_nav2_lks.length-1) 
      { current_foto++; }
	  
      var active_sel = $('active_sel');
      if(active_sel) {active_sel.removeAttribute('id');}
	  foto_nav2_lks[current_foto].setAttribute('id','active_sel');
	  prev.style.visibility  = 'visible';
	
	 gal_nav.clearTimer().toElement($('foto'+(current_foto+1)));
	 fotos_nav_h4.innerHTML = fotos_span[current_foto].innerHTML;
	 return false;
   }
   
   
   for(x=0; x<foto_nav2_lks.length; x++)
  {
	 foto_nav2_lks[x].onclick = function ()
	 {
	
	  var active_sel = $('active_sel');
	  if(active_sel) {active_sel.removeAttribute('id');}
	  this.setAttribute('id','active_sel');
	  for(z=0; z<foto_nav2_lks.length; z++)
	  {
		  if(foto_nav2_lks[z].getAttribute('id')=='active_sel')
		  {  current_foto = z;
		     if(current_foto==0) 
			 {prev.style.visibility = 'hidden';
			  next.style.visibility = 'visible';
			 }
			 else if (current_foto==(foto_nav2_lks.length-1)) 
			 {next.style.visibility = 'hidden';
			 prev.style.visibility = 'visible';
			 } 
			 else {
			  prev.style.visibility = 'visible';	
			  next.style.visibility = 'visible';
			 }
			
			 gal_nav.clearTimer().toElement($('foto'+(current_foto+1)));
			 fotos_nav_h4.innerHTML = fotos_span[current_foto].innerHTML;
		  }
		 
	   }
	  
	 
	  return false;
	 }
	 
	
	
	
	
	var dia_ ='dia_';
	  var _ttl ='_ttl';
	   var _txt ='_txt';
	    var _lk ='_lk';
	  
	   function legende_1(lg)
	   {
	  
	   var st = document.getElementById('info_right');
	    var st_1 = document.getElementById('info_right_1');
	   st.innerHTML ='&nbsp;';
	    st.style.opacity=0;
	     st_1.innerHTML ='&nbsp;';
	    st_1.style.opacity=0;
	    
	   var _ttl_out = document.getElementById(_ttl+lg).firstChild.nodeValue;
	   var _txt_out = document.getElementById(_txt+lg).firstChild.nodeValue;
	   var _lk_href_out = document.getElementById(_lk+lg);
	   var _lk_value_out = document.getElementById(_lk+lg).firstChild.nodeValue;
	    
	    var lnkArray = new Array('http://www.dwdewispelaere.com','http://www.beatrizferrersalat.es','http://www.hamptongreenfarm.com','http://www.usprea.com','#','ttp://www.hamptongreenfarm.com','#','http://www.hipicarural-losangeles.com','http://www.usprea.com','http://www.crucesmorillo.com','http://www.bbgecko.com','http://www.rafaelotero.com');
	   
	   if(lg<=5){
		document.getElementById('info_right').innerHTML = '<h4>'+_ttl_out+'</h4><p>'+ _txt_out +'<br/>';
		var ah = document.createElement('a');
	 ah.setAttribute('href',lnkArray[lg]);
	 ah.setAttribute('rel','external');
	 ah.setAttribute('target','_blank');
	 ah.innerHTML=_lk_value_out;
		st.appendChild(ah);
		  initImage('info_right');
}
if(lg>5 && lg<12){
		document.getElementById('info_right_1').innerHTML = '<h4>'+_ttl_out+'</h4><p>'+ _txt_out +'<br/>';
		var ah = document.createElement('a');
	 ah.setAttribute('href',lnkArray[lg]);
	  ah.setAttribute('rel','external');
	 ah.setAttribute('target','_blank');
	 ah.innerHTML=_lk_value_out;

st_1.appendChild(ah);
  initImage('info_right_1');
}
     

		
		 
		
		
		}
		
		
		
		
		
		
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	 //var contact_lk = document.getElementById('contact_link');
	 //var locatie_lk = document.getElementById('locatie_link');
	 
	
	
	 var lk_item_0 = document.getElementById('lk_item_0');
	  var lk_item_1 = document.getElementById('lk_item_1');
	   var lk_item_2 = document.getElementById('lk_item_2');
	    var lk_item_3 = document.getElementById('lk_item_3');
	     var lk_item_4 = document.getElementById('lk_item_4');
	      var lk_item_5 = document.getElementById('lk_item_5');
	      
	 var lk_item_6 = document.getElementById('lk_item_6');
	  var lk_item_7 = document.getElementById('lk_item_7');
	   var lk_item_8 = document.getElementById('lk_item_8');
	    var lk_item_9 = document.getElementById('lk_item_9');
	     var lk_item_10 = document.getElementById('lk_item_10');
	      var lk_item_11 = document.getElementById('lk_item_11');
	      
	      
	   if(this.className=='lk_item_0' ){ legende(0);}   
	      
	 lk_item_0.onclick = function () { dia_4_nav.clearTimer().toElement($('dia_0')); legende_1(0); return false;}
	 lk_item_1.onclick = function () { dia_4_nav.clearTimer().toElement($('dia_1')); legende_1(1); return false;}
	 lk_item_2.onclick = function () { dia_4_nav.clearTimer().toElement($('dia_2')); legende_1(2); return false;}
	 lk_item_3.onclick = function () { dia_4_nav.clearTimer().toElement($('dia_3')); legende_1(3); return false;}
	 lk_item_4.onclick = function () { dia_4_nav.clearTimer().toElement($('dia_4')); legende_1(4); return false;}
	 lk_item_5.onclick = function () { dia_4_nav.clearTimer().toElement($('dia_5')); legende_1(5); return false;}
	 
	 lk_item_6.onclick = function () { dia_10_nav.clearTimer().toElement($('dia_6')); legende_1(6); return false;}
	 lk_item_7.onclick = function () { dia_10_nav.clearTimer().toElement($('dia_7')); legende_1(7); return false;}
	 lk_item_8.onclick = function () { dia_10_nav.clearTimer().toElement($('dia_8')); legende_1(8); return false;}
	 lk_item_9.onclick = function () { dia_10_nav.clearTimer().toElement($('dia_9')); legende_1(9); return false;}
	 lk_item_10.onclick = function () { dia_10_nav.clearTimer().toElement($('dia_10')); legende_1(10); return false;}
	 lk_item_11.onclick = function () { dia_10_nav.clearTimer().toElement($('dia_11')); legende_1(11); return false;}
	 
	   
	   
	   

	 
   }
  
   
  }
  
  function selectReplacement(obj) {
      obj.className += ' replaced';
      var ul = document.createElement('ul');
      ul.className = 'selectReplacement';
	  ul.setAttribute('id','selectReplacement');
      var opts = obj.options;
      for (var i=0; i<opts.length; i++) {
        var selectedOpt;
        if (opts[i].selected) {
          selectedOpt = i;
          break;
        } else {
          selectedOpt = 0;
        }
      }
      for (var i=0; i<opts.length; i++) {
        var li = document.createElement('li');
		
		var txt = document.createTextNode(opts[i].text);
        li.appendChild(txt);
		
        li.selIndex = opts[i].index;
        li.selectID = obj.id;
        li.onclick = function() {
          selectMe(this);
        }
		
        if (i == selectedOpt) {
          li.className = 'selected';
          li.onclick = function() {
            this.parentNode.className += ' selectOpen';
            this.onclick = function() {
              selectMe(this);
            }
          }
		  
        }
        if (window.attachEvent) {
          li.onmouseover = function() {
            this.className += ' hover';
          }
          li.onmouseout = function() {
            this.className = 
              this.className.replace(new RegExp(" hover\\b"), '');
          }
        }
        ul.appendChild(li);
      }
      obj.parentNode.insertBefore(ul,obj);
    }
    function selectMe(obj) {
      var lis = obj.parentNode.getElementsByTagName('li');
      for (var i=0; i<lis.length; i++) {
        if (lis[i] != obj) {
          lis[i].className='';
          lis[i].onclick = function() {
            selectMe(this);
          }
        } else {
          setVal(obj.selectID, obj.selIndex);
          obj.className='selected';
          obj.parentNode.className = 
            obj.parentNode.className.replace(new RegExp(" selectOpen\\b"), '');
          obj.onclick = function() {
            obj.parentNode.className += ' selectOpen';
            this.onclick = function() {
              selectMe(this);
            }
          }
        }
      }
    }
    function setVal(objID, selIndex) {
      var obj = document.getElementById(objID);
      obj.selectedIndex = selIndex;
    }
    function setForm() {
      var s = document.getElementsByTagName('select');
      for (var i=0; i<s.length; i++) {
        selectReplacement(s[i]);
      }
    }
    
  
	
 function fotos_big_replace() {
	 var fotos_big = $$('.foto');
	 for(m=0; m<fotos_big.length; m++)
    {   fotos_big[m].setAttribute('src',fotos_array[m]);
	  }
	 
	}	
  
 function timer_img ()
	{ var data2 = new Date();
	  window.setTimeout(fotos_big_replace,data2-data1);	
	}
	
 function hide_calendar ()
 {
	var calendar= $$('.calendar');
	
	 for(m=0; m<calendar.length; m++)
   {  document.body.removeChild(calendar[m]);
	  }
}	

  addDOMLoadEvent(path_images);
  addDOMLoadEvent(navigation);
  addDOMLoadEvent(setForm);
 
  addDOMLoadEvent(externalLinks);
  addLoadEvent(timer_img);
 addLoadEvent(clearForm);

  
  
  
  function initImage(t) {
	imageId = t;
	image = document.getElementById(imageId);
	setOpacity(image, 0);
	image.style.visibility = "visible";
	fadeIn(imageId,0);
}

function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += 10;
			window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 30);
		}
	}
}
function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}


 
 
 
 
 
 
 
 