isIE=document.all?true:false;
isNS4=document.layers?true:false;
isNS6=document.getElementById?true:false;
isOpera=navigator.appName.indexOf('opera')!=-1?true:false;


function Theme( deliCat,count, destId , MenuT , header, footer ) { 
    this.deliCat = deliCat; 
    this.count = count; 
    this.destId = destId; 
    this.MenuT = MenuT;  
    this.header = header;
    this.footer = footer;    
}
function MenuItem( linkLabel, url,note,tags ) { 
    this.linkLabel = linkLabel; 
    this.url = url;  
    this.note = note;
    this.tags = tags;
}
var oceatoonT = [];
var SurfalbumsT = [];
var WindsurfalbumsT = [];
var KitealbumsT = [];
var CountryalbumsT = [];
var friendsT = [];
var hotStuffT = [];
var oceaPubT = [];
var hotPhotoT = []

var current_Section = null;
var current_LinkId = "sectionLatestAlbum";
var current_SectionId = 'latestAlbum';
var current_Tag = null;
var currentTagTitle="Windsurfing";
var current_TagId = "windsurfTag";
var DivIdKey = "Wind";
var viewDivT=["listView","latestView","slideView","mapView","timelineView"];

myThemes = {
	"windsurf":new Theme( "windsurf","20", "iframeMenudelicious" , WindsurfalbumsT,"Windsurf Photos",""  ),
	"kite":new Theme( "kitesurfing","20", "iframeMenudelicious" , KitealbumsT ,"Kite Photos","" ),
	"surf":new Theme( "surf","20", "iframeMenudelicious" , SurfalbumsT,"Surf Photos",""  ),
	"country":new Theme( "photocountry","20", "iframeMenudelicious" , CountryalbumsT ,"Country Photos","" ),
	"oceatoonphoto":new Theme( "photooceatoon","30", "" , oceatoonT,"Oceatoon's Photos",""  ),
	"friends":new Theme( "photographer","30", "" , friendsT,"Sites de Photographes ",""  ),
	"hotStuff":new Theme( "hotStuffOceatoon","10", "" , hotStuffT,"Oceatoon Hot Stuff",""  ),
	"oceapub":new Theme( "oceapub","5", "" , oceaPubT,"Time to Move",""  ),
	"hotphoto":new Theme( "hotphoto","5", "" , hotPhotoT,"Hot Photo",""  )
}
window.onload = function (){
	//fill all the MenuT for all themes 
	for(t in myThemes){
		themeObj = myThemes[t];
		getAndBuildDeliciousList( "" , t,false );
	}
	getAndBuildDeliciousList( "latestViewContainer" , "oceatoonphoto",true,"timeLineView","",5);
	getAndBuildDeliciousList( "thumbnailOceatoonWind" , "oceatoonphoto",true,"thumbnailList","windsurf");
	getAndBuildDeliciousList( "thumbnailOceatoonSurf" , "oceatoonphoto",true,"thumbnailList"," surf ");
	getAndBuildDeliciousList( "thumbnailOceatoonKite" , "oceatoonphoto",true,"thumbnailList","kite");
	getAndBuildDeliciousList( "thumbnailOceatoonCountry" , "oceatoonphoto",true,"thumbnailList","country");
	getAndBuildDeliciousList( "reunionMapIcon" , "oceatoonphoto",true,"mapView","",10);
	getAndBuildDeliciousList( "menu2" , "oceapub",true,"thumbnail","",5);
	getAndBuildDeliciousList( "menu3" , "hotphoto",true,"thumbnail","",5);
	//$('frameDipity').contentWindow.getElementById("vp").style.backgroundColor = "#fc0000";
};
	var menuSelector = {"latestView":"lastestalbumFish","slideView":"slideshowFish","listView":"listFish","mapView":"earthFish","timelineView":"timelineFish"};
	function showView(id){
		hideAll(viewDivT);
		for(m in menuSelector){
			$("menu"+m).src = "style/images/mix/"+menuSelector[m]+".png";
		}
		$("menu"+id).src = "style/images/mix/"+menuSelector[id]+"_on.png";
		$(id).show();
	}
	function hideAll(T){
			for(var i = 0 ; i < T.length ; i++){//alert(T[i]);
				$(T[i]).hide() ;
				//Effect.Fade(T[i]) ;
			}
	} 
	function closePage(T){
		for(var x = 0 ; x < T.length ; x++){
				$(T[x]).show() ;
				//Effect.Appear(T[i]);
			}
	}
var current_pageName="",selected_pageName="";
	function openPage(pageName,param){
		hideAll(homeDivT);
		$('popinContent').update('<img src="style/images/loader3.gif" width="50px"/>');
		current_pageName = pageName;
		selected_pageName=pageName;
		current_menu = (param!=null) ? param.menu : "";
		if(pageName.indexOf("http://")>=0){
			doThis = new Ajax.Updater('popinContent', 'pages/popinmenuiframe.html?date='+new Date().getTime(), {method: 'get',evalScripts:true});
		}
		else{
			doThis = new Ajax.Updater('popinContent', pageName+'?date='+new Date().getTime(), {method: 'get',evalScripts:true});
		}
		$('popinPage').style.display= 'block' ;
	}

	function doMenu (theme,destIdOveride,menuLink){
		if(theme!=null){
			themeObj = myThemes[theme];
			destId = (destIdOveride!="")?destIdOveride:themeObj.destId;
			//alert("doMenu::"+theme+"::"+themeObj.destId);
			if(themeObj!=null)
				getAndBuildDeliciousList( destId , theme ,true);
		}else 
			openX(destIdOveride,menuLink,true);
	}
	function showHide(id){
		if( $(id).style.display == 'block' ){
			Effect.Fade(id);//$(id).style.display = 'none' ;
		}
		else {
			Effect.Appear(id);//$(id).style.display = 'block' ;
		}
	}
	function openX(id,pageName,sh){
		if(id=="section5")
			$(id).style["border"]="none";
		$(id).update('<img src="style/images/loader3.gif" width="50px"/>');
		if(sh){
			showHide(id);
		}
		doThis = new Ajax.Updater(id, pageName+'?date='+new Date().getTime(), {method: 'get',evalScripts:true});
	}
	function gotoUrl(url){
		window.location=url;
		/*var browserName=navigator.appName; 
		if (browserName=="Netscape"){
			window.location=url;
		}else { 
		 if (browserName=="Microsoft Internet Explorer"){
		  	window.location=url;
		  } else{
		   window.location=url;
		   }
		} */
	}
	

/* Keyboard interface to the site*/	
//Menu Item Object  
var bestofSize = 10;
var keycodeObj = {"backspace":8,"tab":9,"enter":13,"shift":16,"ctrl":17,"alt":18,"pause/break":19,"capslock":20,"escape":27,"pageup":33,"pagedown":34,"end":35,"home":36,"left":37,"up":38,"right":39,"down":40,"insert":45,"delete":46,"0":48,"1":49,"2":50,"3":51,"4":52,"5":53,"6":54,"7":55,"8":56,"9":57,"a":65,"b":66,"c":67,"d":68,"e":69,"f":70,"g":71,"h":72,"i":73,"j":74,"k":75,"l":76,"m":77,"n":78,"o":79,"p":80,"q":81,"r":82,"s":83,"t":84,"u":85,"v":86,"w":87,"x":88,"y":89,"z":90,"left window key":91,"right window key":92,"select key":93,"numpad 0":96,"numpad 1":97,"numpad 2":98,"numpad 3":99,"numpad 4":100,"numpad 5":101,"numpad 6":102,"numpad 7":103,"numpad 8":104,"numpad 9":105,"multiply":106,"add":107,"subtract":109,"decimal point":110,"divide":111,"f1":112,"f2":113,"f3":114,"f4":115,"f5":116,"f6":117,"f7":118,"f8":119,"f9":120,"f10":121,"f11":122,"f12":123,"num lock":144,"scroll lock":145,"semi-colon":186,"equal sign":187,"comma":188,"dash":189,"period":190,"forward slash":191,"grave accent":192,"open bracket":219,"back slash":220,"close braket":221,"single quote":222};					  
//oceatoonphoto,surf,wind,country,kite,style
var indexT = [0,0,0,0,0];
var active_albumT = [];

    function showImage(img){ return (function(){ img.style.display='inline'; }); }
	//@theme is a delicious category
	//@destId is div container
	//buildParam is object build is boolean ,buildStyle is str,filterTag is str, limitView is num
	function getAndBuildDeliciousList( destId , theme , build ,buildStyle,filterTag,limitView){
		//console.log("getAndBuildDeliciousList ::"+destId)
		MenuT = myThemes[theme].MenuT;
		destId = (destId!=null)? destId : "delicious";
		count = (myThemes[theme].count!=null)? myThemes[theme].count : "20";
		deliCatUrl = (myThemes[theme].deliCat!=null)? "/"+myThemes[theme].deliCat+"?count="+count : "?count="+count;
    	if(destId!=null && destId!="" && destId!="swappingSection")
    		$(destId).update('<img src="style/images/loader3.gif" width="50px"/>');
    	MenuTlength = MenuT.length;
    	//console.log("getAndBuildDeliciousList :: get "+deliCatUrl+" update ::"+destId);
    	if(MenuTlength==0)
    		LoadScript('http://del.icio.us/feeds/json/oceatoon'+deliCatUrl+'?date=dodp',function () {buildDeliciousList(destId,theme,build,buildStyle,filterTag,limitView);},destId);
    	else
    		buildDeliciousList(destId,theme,build,buildStyle,filterTag,limitView);
    }	
    var countTags=0;
    var alltagsStr = "";//liste de tous les tags disponible
    function buildDeliciousList(destId,theme,build,buildStyle,filterTag,limitView){
    	menuT = myThemes[theme].MenuT;
    	//getting and caching 
    	MenuTlength = menuT.length;
    	if(limitView!=null && limitView < MenuTlength)
    		MenuTlength = limitView;
    	if(menuT.length==0 || menuT.length==1){
    		for (var i=0, post; post = Delicious.posts[i]; i++) {
    			tagsT = post.t;
    			tagsStr = "";
    			//concatenate all tags
    			for (var ct=0; ct < tagsT.length; ct++) {
    				tagsStr += " "+tagsT[ct];
    				if(alltagsStr.indexOf(tagsT[ct])<0){
    					alltagsStr += " "+tagsT[ct];
    					countTags++;
    				}
    			}
		       menuT[i] = new MenuItem(post.d,post.u,post.n,tagsStr);
		    }
	    }
	   // alert("buildDeliciousList "+buildStyle+" building menu ? "+build+" :: "+menuT.length+":"+theme);
	    if(build){
	    	switch (buildStyle) {
	    		case "flatButtonList" : buildFlatButtonList (destId,MenuT,MenuTlength);break;
	    		case "thumbnail" : buildThumbnail (destId,MenuT,MenuTlength,filterTag); break;
	    		case "thumbnailList" : buildThumbnailList (destId,MenuT,MenuTlength,filterTag); break;
	    		case "timeLineView" : buildtimeLineView (destId,MenuT,MenuTlength,filterTag); break;
	    		case "slideView" : buildSlideView (destId,MenuT,MenuTlength,filterTag); break;
	    		case "mapView" : buildMapView (destId,MenuT,MenuTlength,filterTag); break;
	    		default : buildMenu (destId,theme,MenuT,MenuTlength,filterTag);break
	    	}
	    }
    }	
    
	function buildObjectHTML(id , url , w , h){
		 $(id).update('<object width="'+w+'" height="'+h+'"><param name="movie" value="'+url+'"></param><embed src="'+url+'" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed></object>');
	}
	function buildFlatButtonList(destId,MenuT,MenuTlength){
		document.getElementById(destId).innerHTML = "";
		var ul = document.createElement('ul');
		ul.style.cssText = "list-style-type: none; padding:0px; margin:0px;";
		 for (var ix=0; ix < MenuTlength; ix++) {
		 	var obj = menuT[ix];
		 	var li = document.createElement('li');
	        li.style.cssText = "margin:0px 10px 0px 0px";
	        li.className="flatList2";
	        var a = document.createElement('a');
	        a.id = destId+ix;
	        a.className="buttonOpo";
	        a.href=obj.url;
	        a.setAttribute('target', "_blank");
	        a.appendChild(document.createTextNode(obj.linkLabel));
	        li.appendChild(a);
	        ul.appendChild(li);
	    }
	    document.getElementById(destId).appendChild(ul);
	     buildStyle="";
	}
	
	function buildThumbnail(destId,MenuT,MenuTlength,filterTag){
		document.getElementById(destId).innerHTML = "";
		 for (var ix=0; ix < MenuTlength; ix++) {
		 	var obj = menuT[ix];
		 	var tags = obj.tags;
	    	var dontDraw = false;
	    	if( filterTag!=null && filterTag!="" && tags.indexOf(filterTag)<0 )
	    		dontDraw = true; 
	    	
	    	if(!dontDraw){
		        var src = (obj.note=="") ? "style/images/waterQ.PNG" : obj.note;
				var HTMLstr = "<div>"+
				"<img src='"+src+"' height='120' width='100' style='border:none;cursor:pointer;display:inline;' onclick='window.open(\""+obj.url+"\",\""+obj.linkLabel+"\")'>"+
				"<br/><a class='ListLink' id='"+destId+ix+"' href='"+obj.url+"' target='_blank'>"+obj.linkLabel+"</a>"+
				"</div>";
				document.getElementById(destId).innerHTML += HTMLstr; 
	    	}
	    }
	    buildStyle="";
	}
	
	function buildThumbnailList(destId,MenuT,MenuTlength,filterTag){
		document.getElementById(destId).innerHTML = "<ul style='list-style-type: none; padding:0px; margin:10px;'>";
			
		 for (var ix=0; ix < MenuTlength; ix++) {
		 	var obj = menuT[ix];
		 	var tags = obj.tags;
	    	var dontDraw = false;
	    	if( filterTag!=null && filterTag!="" && tags.indexOf(filterTag)<0 )
	    		dontDraw = true; 
	    	
	    	if(!dontDraw){
				var src = (obj.note=="") ? "style/images/waterQ.PNG" : obj.note;
				HTMLstr = "<li style='list-style-type:none;width:450px;padding:10px;margin:0px 5px 10px 0px;border:1px solid white;'>"+
				"<img src='"+src+"' height='60' width='125' style='border:none;padding-right:10px;vertical-align:middle;display:inline;' onclick='window.open(\""+obj.url+"\",\""+obj.linkLabel+"\")'/>"+
		        "<a class='MenuLink' id='"+destId+ix+"' href='"+obj.url+"' target='_blank'>"+obj.linkLabel+"</a>"+
				"<span style='font-size:x-small;'>by Oceatoon</span>"+
				"</li>";
				
		        document.getElementById(destId).innerHTML += HTMLstr ;
	    	}
	    }
	    document.getElementById(destId).innerHTML += "</ul>" ;
	     buildStyle="";
	}
	
	var prevActiveSlide = null
	function buildtimeLineView(destId,MenuT,MenuTlength,filterTag){
		document.getElementById(destId).innerHTML = "";
		prevWidth = 0;
		startObj = null;
		 for (var ix=0; ix < MenuTlength; ix++) {
		 	var sx = MenuTlength-ix;
		 	var obj = menuT[ix];
		 	
		 	if(ix==0)startObj = obj; 
		 	//console.log(obj.url);
		 	var tags = obj.tags;
	    	var dontDraw = false;
	    	if( filterTag!=null && filterTag!="" && tags.indexOf(filterTag)<0 )
	    		dontDraw = true; 
	    	
	    	if(!dontDraw){
	    		var div = document.createElement('div');
		        width = 80*(sx+1);
		        slidetop = 150+ (80*(ix));
		        slideleft = 40+ (120*(ix));
		       
		        prevWidth = width;
		        
		        div.style.cssText = "z-index:"+sx+"; position:absolute; top:"+slidetop+"px;left:"+slideleft+"px;cursor:pointer;";
				img = document.createElement('img');
				img.src = (obj.note=="") ? "style/images/waterQ.PNG" : obj.note;
				img.width = 80*(sx+1);
				img.height = 50*(sx+1);
				if(ix==0){
					prevActiveSlide = img;
					activeColor = "#fe0000"; 
				}else
					activeColor = "#77777F";
				img.index = ix;
				img.divTop = slidetop;
				img.divLeft = slideleft;
		        img.style.cssText = "border:8px solid "+activeColor+";";
		        img.onmouseover = function(){mouseOverSlide(this);};
		        div.appendChild(img);
		        document.getElementById(destId).appendChild(div);
	    	}
	    }
	    var a = document.getElementById("albumLink");
        a.href=startObj.url;
        a.setAttribute('target', "_blank");
        a.appendChild(document.createTextNode(startObj.linkLabel));
	    buildStyle="";
	}
	function mouseOverSlide(slide){
		prevActiveSlide.style.cssText="border:8px solid #77777F;";
		prevActiveSlide.parentNode.style.cssText = "z-index:"+slide.style.zIndex+";position:absolute; top:"+prevActiveSlide.divTop+"px;left:"+prevActiveSlide.divLeft+"px;";
		
		slide.parentNode.style.cssText = "z-index:6;position:absolute; top:"+slide.divTop+"px;left:"+slide.divLeft+"px;";
		slide.style.cssText="border:8px solid #fe0000;";
		slide.onclick = function(){
			if(oceatoonT[slide.index].url.indexOf("http://")>=0) 
				window.open(oceatoonT[slide.index].url,oceatoonT[slide.index].linkLabel);
			else
				eval(oceatoonT[slide.index].url.url);
		};
		document.getElementById("albumLink").href=oceatoonT[slide.index].url;
		document.getElementById("albumLink").innerHTML=oceatoonT[slide.index].linkLabel;
		prevActiveSlide = slide;
	}
	
	var LocationPos={"stleu":{"y":275,"x":110},
					 "pointeausel":{"y":320,"x":110},
					 "etangsale":{"y":355,"x":140},
		     		 "ravineblanche":{"y":400,"x":220},
		     		 "boucan":{"y":160,"x":70},
		     		 "indonesia":{"y":400,"x":550}};
	function buildMapView(destId,MenuT,MenuTlength,filterTag){
		for(l in LocationPos){
			if(LocationPos[l].html!=null)
				LocationPos[l].html = null;
		}
		var HTML = "";
		var first = true;
		 for (var ix=0; ix < MenuTlength; ix++) {
		 	var obj = menuT[ix];
		 	var tags = obj.tags;
	    	var dontDraw = false;
	    	if( filterTag!=null && filterTag!="" && tags.indexOf(filterTag)<0 )
	    		dontDraw = true; 
	    	
	    	if(!dontDraw){
	    		var src = (!first) ? "style/images/mix/camera.png" : "style/images/mix/cameraRed.png";
	    		var width = (!first) ? "35" : "50";
	    		first = false;
	    		var imgTop = 0;
				var imgLeft = 0;
				var locationFound = false;
				var locationExist = false;
				var loc = "";
				counterY = 0;
				
				for(l in LocationPos){
					if(tags.indexOf(l)>=0){
						locationFound = true;
						loc = l;
						imgTop = LocationPos[l].y;
						imgLeft = LocationPos[l].x;
						//console.log("FOUND LOCATION y:"+imgTop+" / x:"+imgLeft+" :: "+loc);
						//console.log(tags);
						//console.log(obj.linkLabel+" :: "+obj.url);
						if(LocationPos[l].html==null)
							LocationPos[l].html = '<a class="ListLink" href="'+obj.url+'" target="_blank">'+obj.linkLabel+'</a>';
						else{
							LocationPos[l].html += '<br/><a class="ListLink" href="'+obj.url+'"  target="_blank">'+obj.linkLabel+'</a>';
							locationExist = true;
						}
						if(l=="indonesia"){
							src = "style/images/mix/cameraArrow.png";
							width = "200";
						}
						break;
					}
				}
				if(!locationFound){
					console.error("LOCATION NOT FOUND >>> y:"+imgTop+" / x:"+imgLeft+" :: "+loc);
					console.error(tags);
					console.error(obj.linkLabel+" :: "+obj.url);
				}
					
				if(!locationExist){
	    			//console.log("Drawing Location y:"+imgTop+" / x:"+imgLeft+" :: "+loc);
	    			HTML += '<img src="'+src+'" style="float:left;width:'+width+'px;position:absolute;top:'+imgTop+'px;left:'+imgLeft+'px;z-index:1;" onmouseover="$(\'infoDiv\').innerHTML = LocationPos[\''+loc+'\'].html; openInfoDivAtMousePos(this);" onmouseout="hideInfoDiv()"/>';
	    		}
	    	}
	    }
	    $(destId).innerHTML = HTML; 
	}
	
function openInfoDivAtMousePos(div){
	var posX = 0, posY = 0;
    do
    {
        posX += div.offsetLeft;
        posY += div.offsetTop;
        div = div.offsetParent;
    } while( div != null );
    posX -=140;
	$('infoDiv').style.top = posY+"px";
  	$('infoDiv').style.left = posX+"px";
  	$('infoDiv').show();
  	hideInfoDivBool = false;
  	
}
hideInfoDivBool = true;
function hideInfoDiv(){
	hideInfoDivBool = true;
	setTimeout("excuteHideInfoDiv()", 3000);
}
function excuteHideInfoDiv(){
	if(hideInfoDivBool)$('infoDiv').hide()
}
	
	function buildMenu(destId,theme,MenuT,MenuTlength,filterTag){
	    var ul = document.createElement('ul');
    	ul.style.cssText = "list-style-type:none;width:100%;padding:0px;margin:0px;";
	    for (var i=0; i < MenuTlength; i++) {
	    	var obj = menuT[i];
	    	var tags = obj.tags;
	    	var dontDraw = false;
	    	if( filterTag!=null && filterTag!="" && tags.indexOf(filterTag)<0 )
	    		dontDraw = true; 
	    	
	    	if(!dontDraw){
		        var li = document.createElement('li');
		        //li.className = "bottomBorder";
		        var a = document.createElement('a');
		        a.style.marginLeft = '20px';
	        	a.href=obj.url;
	        	a.setAttribute('target', "_blank");
		        if(theme=="links")
		        	a.setAttribute('target', '_blank');
		        var Aclass = "ListLink";
		        if(selected_pageName == obj.url)
		        	Aclass ="selectedLink";
		        a.className = Aclass;
		        a.appendChild(document.createTextNode(obj.linkLabel));
		        li.appendChild(a);
		        ul.appendChild(li);
		        var header = document.createElement('span');
		        header.className="title";
		        header.appendChild(document.createTextNode(myThemes[theme].header));
	    	}
	    }
		document.getElementById(destId).innerHTML = "";
	    document.getElementById(destId).appendChild(header);
	    document.getElementById(destId).appendChild(ul);
	}
	
	var photoix = 1;
	var photoT = [];
	function buildorSwapTPhoto(){
		if(photoT.length==0){
			doThis = new Ajax.Request('scripts/getFlickr.php', { method:'get',
			  	onSuccess: function(requestObj){
			  		var xmlDoc = requestObj.responseXML;	
					var photos = xmlDoc.documentElement.getElementsByTagName("photo");
				      
			      for (var i = 0; i < photos.length; i++) {
			        var active_photo = photos[i];
			        var farmId = active_photo.getAttribute("farm");
			        var serverId = active_photo.getAttribute("server");
			        var photoId = active_photo.getAttribute("id");
			        var secret = active_photo.getAttribute("secret");
			        var url = "http://farm"+farmId+".static.flickr.com/"+serverId+"/"+photoId+"_"+secret+".jpg";
			        
			        photoT.push(url);
			        if(i==0){$('flickrImg').src = url;}
				    }
			    },
			    onFailure: function(requestObj){		    
			    	alert('an error occured.' ) ; 
			    }
			});	
		}else{
			$('flickrImg').src = photoT[photoix]; 
			photoix = ( photoix >= photoT.length-1 ) ? 0 : photoix+1;
		}
	}
	function LoadScript(url,func,destId){
	
			//alert("LoadScript getting : "+url);
			if(destId!="" && destId!=null && destId!="swappingSection")
	    		$(destId).update('<img src="style/images/loader3.gif" width="50px"/>');
			var head = document.getElementsByTagName('head')[0];
			var script = document.createElement('script');
			script.type = 'text/javascript';
			script.src = url;
			if (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)) {
		      // IE
		      script.onreadystatechange = function(){ if (this.readyState == 'loaded') { func(); } }
		    } else {
		      // Other browsers
		      script.onload = func;
		    }
		   	head.appendChild(script);
		
	}

activeSwapId = -1;
activeImg = "swappingSectionImg";
function swapInfoSection(id){
	if(oceatoonT.length!=0){
		activeSwapId = (activeSwapId >= oceatoonT.length-1)? 0 : activeSwapId+1;
		swapItem = oceatoonT[activeSwapId];
		$("swappingSectionImg").src = (swapItem.note=="") ? "style/images/water.jpg" : swapItem.note;
		$("swappingSection").onclick = (swapItem.url.indexOf("http://")>=0) ? function(){ window.open(swapItem.url,swapItem.linkLabel);} : function(){eval(swapItem.url);};
		 
		$("swapSecName").innerHTML = swapItem.linkLabel;
		if(activeSwapId <= 0){ 
			swapSecNamePrevious = "";
			$('swapPreviousImg').hide();
		}else{
			swapSecNamePrevious = oceatoonT[activeSwapId-1].linkLabel;
			$('swapPreviousImg').show();
		}
		$("swapSecNamePrevious").innerHTML = swapSecNamePrevious;
		
		if(activeSwapId == oceatoonT.length-1){ 
			swapSecNameNext = "";
			$('swapNextImg').hide();
		}else{
			swapSecNameNext = oceatoonT[activeSwapId+1].linkLabel;
			$('swapNextImg').show();
		}
		$("swapSecNameNext").innerHTML = swapSecNameNext;
	}
}
function contentSwap(from, to , title){
	$(to).innerHTML = '<h1 style="font-weight:bold; text-align:left"">'+title+'</h1>'+$(from).innerHTML+'<hr style="clear:left"/>';
}






