/*
* object.watch v0.0.1: Cross-browser object.watch
*
* By Elijah Grey, http://eligrey.com
*
* A shim that partially implements object.watch and object.unwatch
* in browsers that have accessor support.
*
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/



function beep() {
   //java.awt.Toolkit.getDefaultToolkit().beep();
   }


if (!window.console || !console.firebug &&(false)) {
		var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
			"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];

		var emptyFunction = function() {};
		window.console = {};
		for (var j = 0, count = names.length; j < count; ++j) {
			window.console[names[j]] = emptyFunction;
		}
}/**/

var Button = function($div,enabled){
	this.test={enabled:false}
	var me=this
	this.div=$div;
	var id='#'+this.div.attr('id');
	this.element=$div;
	this.enabled=false;
	this.click		=	function(handler){ $(id+' img.enabled').bind('click touchend', handler);  $(id+' img.disabled').click(function(){beep()})}
	this.mouseenter	=	function(handler){ $(id+' img.enabled').mouseenter(handler)	}
	this.mouseleave	=	function(handler){ $(id+' img.enabled').mouseleave(handler)	}
	this.mouseup	=	function(handler){ $(id+' img.enabled').mouseup(handler)	}
	this.mousedown	=	function(handler){ $(id+' img.enabled').mousedown(handler)	}
	this.bind		=  	function(evts, handler){ $(id+' img.enabled').bind(evts,handler)	}

	this.setEnabled = function(val){
		this.enabled = this.onEnabledChange('', this.enabled, val)


	}
	this.getEnabled = function(){
		return this.enabled
	}

	this.onEnabledChange=function(name, oldValue, newValue){
		//alert('onEnabledChange')
		if(newValue){
			$(id+' img.enabled').show()
			$(id+' img.disabled').hide()
		}else{
			$(id+' img.enabled').hide()
			$(id+' img.disabled').show()
		}
		return newValue
	}



			


	this.setEnabled(enabled);
}

$(document).ready(function() {
	//console.log('### ready js/main.js')
	//menu=new Menu('menu')
	$('.linkPop').each(function(ix){
		//$( this ).attr('style','color:#0f0')
	})
	$('.linkPop').click(function(e){
		var href=$( this ).attr('href')
		var cT=e.currentTarget;
		pop=window.open(cT, "Zweitfenster", "width=916,height=600,left=136,top=136,scrollbars=yes");
		pop.focus();
		return false
	})
	$('.linkPopImg').click(function(e){
		var href=$( this ).attr('href')
		var cT=e.currentTarget;
		console.log(href,cT)
		pop=window.open('detail.php?img='+href, "Zweitfenster", "width=916,height=600,left=136,top=136,scrollbars=yes");
		pop.focus();
		return false
	})


	$('.linkAkk').each(function( intIndex ){
		var newHREF = $( this ).attr('href')
		var temp=newHREF.split('#')
		var hash='#'+temp[1];
		temp=temp[0]
		temp=temp.split('/')
		var fileName=temp[temp.length-1]
		var llItem=1*fileName.substring(2,4)
		//console.log(fileName+' - '+hash)
		$( this ).attr('href', '../Lebenslinie/index.php?llItem='+llItem+'&a='+escape(hash)+'&url='+fileName);
	})
});







