function SlideMenu() {
	var this1 = this;
	var debug	= true;
	
	this1.id = "SlideMenu"; // name of this object
  /*----------------------------------------------------------------------------------------
  
   Local Variables
   
   -----------------------------------------------------------------------------------------*/
	/* save initial button text as in html defined */
	
	
	var initCountryText = '';
	var initKeywordText = '';
	var initSpeedText   = '';
	var initRateText    = '';
	//var initMapText = '';
	
	var intervalID = 0; // for timer 
	var slideShow = true; // if speed > 0 then slideShow = on
	var currentFileName = '';

	var initSpeed   = '';
	logit('initCountryText='+initCountryText);

  // properties for Menu
  this1.menuevent = function(eventcd) {}
	this1.showMap = function() {}
	this1.showPic = function() {}
	this1.swapMap = function() {}
	this1.mapAvail = function() {}
  /*----------------------------------------------------------------------------------------
  
   Method : setConsole
   
   Method to display a message (msg) on the Console-button. ok = true : green back,false : red back
  
   -----------------------------------------------------------------------------------------*/
	this1.setconsole = function(msg,ok) {
		if (!this1.consoleId) return;
		logit("setconsole:"+msg);
		if (this1.pause == false) {
			if (ok) {
				this1.pause4error = false;
				$("ul#sddm > li > a#consoleText").html(msg).removeClass().addClass("greenBack");
			} else {
				this1.pause4error = true;
				$("ul#sddm > li > a#consoleText").html(msg).removeClass().addClass("redBack");
			}
		}
	}
  /*----------------------------------------------------------------------------------------
  
   Local Function : menuReset
   
   -----------------------------------------------------------------------------------------*/
	var menuReset = function() {
		logit('menuReset');
		
		$("ul#sddm > li > a#menuheadCountry").html(initCountryText);
		$("ul#sddm > li > a#menuheadKeyword").html(initKeywordText);
		$("ul#sddm > li > a#menuheadSpeed").html(initSpeedText);
		$("ul#sddm > li > a#menuheadRate").html(initRateText);

		this1.getcountryIso  = '';
		this1.getkeywords = '';
		this1.intervalVal = initSpeed;
		this1.noimage     = false;
		
		this1.pause4error = false;
	}
  /*----------------------------------------------------------------------------------------
  
   Local Function : changeCountry
   
   -----------------------------------------------------------------------------------------*/
	var changeCountry = function(thisobject) {
		var selcountryIso = thisobject.title;
	  var selcountry = $(thisobject).html();
		logit("changeCountry : "+selcountryIso+'/'+selcountry);
		if (selcountryIso != "") {
			$("ul#sddm > li > a#menuheadCountry").html(selcountry);

			if (selcountryIso.substr(0,6) == 'Select') {
				this1.getcountryIso = '';
			} else {
				this1.getcountryIso = selcountryIso;
				return 'first';
			} 
		}
 		//thismenuevent("changeCountry");
		return '';	
	}
  /*----------------------------------------------------------------------------------------
  
   Local Function : changeKeyword
   
   -----------------------------------------------------------------------------------------*/
	var changeKeyword = function(thisobject) {
		var selkeyword = thisobject.title;
		logit('changeKeyword:'+selkeyword);

		if (selkeyword != "") {
			logit('Keyword set to '+ selkeyword);
			$("ul#sddm > li > a#menuheadKeyword").html(selkeyword);
			if (selkeyword.substr(0,6) == 'Select') {
				this1.getkeywords = '';
			} else {
				this1.getkeywords = selkeyword; 
				return 'first';
			}
		}
		return '';	
	}
  /*----------------------------------------------------------------------------------------
  
   Local Function : changeSpeed
   
   -----------------------------------------------------------------------------------------*/
	var changeSpeed = function(thisobject) {
		var selspeed = thisobject.title;
		logit("!!!!!!!changeSpeed : "+selspeed);

		if (selspeed != "Pause") {
			$("ul#sddm > li > a#menuheadSpeed").html("Speed "+selspeed);
			this1.intervalVal = selspeed * 1000;
			slideShow = true;
			if (this1.pause) {
				this1.pauseOff(false);
			}
		} else {
			this1.intervalVal = 0;
			slideShow = false;
			this1.pauseOn();
			$("ul#sddm > li > a#menuheadSpeed").html("Paused");
		}
 		//thismenuevent("changeSpeed");
		return(false);	
	}
  /*----------------------------------------------------------------------------------------
  
   Local Function : setRate - Ajax call for setting rating
   
   -----------------------------------------------------------------------------------------*/
	var setRate = function(thisobject,callback) {
		if (currentFileName == "") {
			logit("Cannot set Rate because no filename known");
			return;
		} else {
			logit("setRate for:"+currentFileName);
		}
		var selrate = thisobject.title.substr(0,1);
		logit("setRate : "+selrate);
		$.ajax({
			type	: "GET",
			url		: "ajaxRate.php",
			data	: "func=SET"
							+"&filename="+currentFileName
							+"&rating="+selrate,
			error: function() {
				/*newstatus("error");*/
				$("ul#sddm > li > a#menuheadRate").html("Login to Rate");
			},
			success: function(data){
				$("ul#sddm > li > a#menuheadRate").html("Rated "+selrate);
				callback();
			}
		});
 		//thismenuevent("setRate");
	}
  /*----------------------------------------------------------------------------------------
  
 	 Overwrite SlideImage Function changestatus
 	 
 	 + callback function
 	   
   -----------------------------------------------------------------------------------------*/
  var statusCallback = [];   // Callback array from changestatus
	this1.addStatusCallback = function(cb) {
		statusCallback.push(cb); // add function to callback array
	}
	this1.changestatus = function() {
		logit('changestatus:'+this1.statuscd);

		// Callback the orders functions (ordered by addStatusCallback 
		for ( var i in statusCallback ) {
			statusCallback[i](this1.statuscd);
		}
		switch (this1.statuscd) {
	  case "loading":
	    this1.setconsole("running.",true);
	    break;
	  case "received":
	    this1.setconsole("running..",true);
			if (this1.pic.point.lat != null) {
					this1.mapAvail(true);
			} else {
				this1.mapAvail(false);
			}
	    break;
	  case "error":
	    this1.setconsole("not found...",false);
	    break;
	  case "notfound":
	    this1.setconsole("not found...",false);
	    break;
	  case "swapped":
	    this1.setconsole("running...",true);
	    imgLoaded(this1.pic.geomap.src,function(img) {
		    //logit('display='+$('#imageMap1').css('display'));
				$('#imageMap1').show().attr("src",img.src);
			});
	    break;
	  case "ready":
	  	if (this1.noimage) {  	
	  		this1.mapAvail(false);	
		    this1.setconsole("no more images",false);
		  } else {
		    this1.setconsole("running",true);
		    currentFileName = this1.pic.fileName;
		  } 
	    break;
	  default:
	    break;
		}
	}
  /*----------------------------------------------------------------------------------------
  
   Local Function : RandMenuInit
   
   -----------------------------------------------------------------------------------------*/
	this1.initSlideMenu = function() {
		logit("initSlideMenu this.id="+this.id);
		this1 = this;
		var l_func = '';
		

		initCountryText = $("ul#sddm > li > a#menuheadCountry").html();
		initKeywordText = $("ul#sddm > li > a#menuheadKeyword").html();
		initSpeedText = $("ul#sddm > li > a#menuheadSpeed").html();
		initRateText = $("ul#sddm > li > a#menuheadRate").html();
		//initMapText = $("ul#sddm > li > a#mapButton").html();
		
		intervalID = 0; // for timer 
		slideShow = true; // if speed > 0 then slideShow = on
		currentFileName = '';
	
		initSpeed   = '';
		logit('initCountryText='+initCountryText);

		this1.initSlideControl();
		this1.startShow('last');
		//this1.consoleId = true;
		this1.consoleId 	= $("ul#sddm > li > a#consoleText").html();
		logit("============================this1.consoleId="+this1.consoleId);
		initSpeed = this1.intervalVal; // store interval speed for reset 

		if (document.getElementById("sddm")) {
			logit("Page has dropdown menu");	
			this1.dropdown = new Dropdown();
		
			this1.dropdown.active = function() {
				logit("dropdown active");
				this1.pauseOn();
			}
			this1.dropdown.inactive = function() {
				logit("dropdown inactive");
				if (slideShow /*&& mapshown == false*/) {
					this1.pauseOff(true);
				}
			}
			this1.dropdown.clickItem = function(thisobject,parent) {
				logit('RandMenu clickItem:'+thisobject.id+'/'+parent);
				switch (parent) {
			  case "menuCountry":
			  	l_func = changeCountry(thisobject);
			  	this1.triggerNow(l_func);
			  	break;
			  case "menuKeyword":
			  	l_func = changeKeyword(thisobject);
			  	this1.triggerNow(l_func);
			    break;
			  case "menuSpeed":
			  	changeSpeed(thisobject);
			  	this1.triggerTimeout();
			    break;
			  case "menuRate":
			  	setRate(thisobject,function() {this1.pauseOff(true);});
			    break;
			  case "":
					switch (thisobject.id) {
				  case "consoleText":
				  	menuReset();
				  	this1.triggerNow('first');
				  	break;
				  case "mapButton":
				  	this1.swapMap();
				  	break;
				  }
			    break;
				}
			}
		} else {
			logit("**** SDDM NOT FOUND ****");
		}
		
		$("#imageMap1").hide().hover(function() {this1.pauseOn();}
													,function() {this1.pauseOff(true);});
	}
	function logit(text) {
		logitAll("SlideMenu-"+text);
	}

}
logit("extend SlideControl to SlideMenu");
SlideMenu.prototype = new SlideControl();
SlideMenu.prototype.constructor = SlideMenu;

