function ahref(link){window.location.href=link;}
function popupWindow(url,width,height){window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width='+width+',height='+height+',screenX=150,screenY=150,top=150,left=150');}
function popupScrolWindow(url,width,height){window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no,width='+width+',height='+height+',screenX=150,screenY=150,top=150,left=150');}
function hoverIE(menu){var MENU=document.getElementById(menu);if(LI=getFirstElementWithTagname(MENU,'UL')){LI=LI.firstChild;do{LI.onmouseover=displayMenuDropDown;LI.onmouseout=hideMenuDropDown;LI=LI.nextSibling;}
while(LI);}}
function getFirstElementWithTagname(OBJ,TAG){ELEMENTS=OBJ.getElementsByTagName(TAG);if(ELEMENTS[0])return ELEMENTS[0];else return false;}
function displayMenuDropDown(){this.className='active';if(UL=getFirstElementWithTagname(this,'UL')){UL.style.display="block";}}
function hideMenuDropDown(){this.className=null;if(UL=getFirstElementWithTagname(this,'UL')){UL.style.display="none";}}
function toggleAuto(target){if(typeof(target)=='string')target=document.getElementById(target);if(target.style.display=="none"){if(arguments[1])display=arguments[1];else display="block";target.style.display=display;}else{target.style.display="none";}}
function removeCDATA(text){return text.substring(9,text.length-3);}
function showToolTip(target,options){target=$(target);if(target){if(!target.tooltip)target.tooltip=new ToolTip(target,options);target.tooltip.show();}}
function closeToolTip(target){target=$(target);if(target&&target.tooltip)target.tooltip.hide();}
var ToolTip=Class.create({initialize:function(target,options){this.timeout=false;this.target=target||false;this.options=options||{};this.options.className=this.options.className||'tooltip';this.options.hideOn=this.options.hideOn||'mouseout';this.options.showOn=this.options.showOn||'mouseover';this.options.align=this.options.align||'right bottom';this.options.shift=this.options.shift||'5 5';this.options.content=this.options.content||false;this.options.autoUpdate=this.options.autoUpdate||(this.options.content?false:true);this.options.title=this.options.title||false;this.options.delay=this.options.delay||0.1;this.options.observe=this.options.observe||true;this.setup=false;if(this.options.observe){if(Object.isElement(this.target)){this.observe(this.target);}else if(this.target){Event.observe(window,'load',this.observeSelector.bindAsEventListener(this));}}},dosetup:function(){this.tooltip=new Element('div',{'class':this.options.className,'style':'position:absolute;'}).hide();this.top=new Element('div',{'class':'top'});if(this.options.hideOn=='click'){this.closeButton=new Element('div',{'class':'closeButton'});this.closeButton.observe('click',this.hide.bindAsEventListener(this,this.closeButton));this.top.appendChild(this.closeButton);}
if(this.options.title!=false){this.title=new Element('h6').update(this.options.title);this.top.appendChild(this.title);}
this.tooltip.appendChild(this.top);this.content=new Element('div',{'class':'inner'});if(this.options.content!=false)
this.content.update(this.options.content);this.tooltip.appendChild(this.content);this.bottom=new Element('div',{'class':'bottom'});this.tooltip.appendChild(this.bottom);$$('body')[0].appendChild(this.tooltip);this.setup=true;},observeSelector:function(){var target=$$(this.target);if(target&&this.options.showOn!=false){target.each(function(Element){this.observe(Element)}.bind(this));}},update:function(content){this.content.update(content);},show:function(e){if(!this.setup){this.dosetup();}
if(this.tooltip.visible()){return false;}
if(e&&Object.isElement(e)){this.target=e;}else{e=this.target;}
if(this.options.autoUpdate){if(e.readAttribute('title')){e.ttip=unescape(e.readAttribute('title'));e.removeAttribute('title');e.select('img').each(function(child){child.removeAttribute("alt");child.removeAttribute("title");});}
if(this.myUpdate){this.myUpdate();}else if(e.ttip){this.update(e.ttip);}}
if(this.options.showOn=='click'&&e.readAttribute('href')){e.removeAttribute("href");e.style.cursor="pointer";}
this.locate();this.tooltip.show();},hide:function(){this.tooltip.hide();},mousemove:function(event){this.locate(Event.pointerX(event),Event.pointerY(event));},click:function(event,element){this.show(element);},locate:function(x,y){if(!x||!y){var ep=this.target.positionedOffset();x=ep.left;y=ep.top;}
var td=this.tooltip.getDimensions();var s=this.options.shift.split(' ',2);var sx=s[0];var sy=(s[1])?s[1]:'top';switch(sx){case'left':break;case'center':x-=(td.width/2);break;case'right':x-=td.width;break;default:if(!isNaN(sx)){x+=parseInt(sx);}
break;}
switch(sy){case'top':break;case'middle':y+=(td.height/2);break;case'bottom':y+=td.height;break;default:if(!isNaN(sy)){y+=parseInt(sy);}
break;}
if(this.options.showOn!='mousemove'){var ed=(this.target.getDimensions)?this.target.getDimensions():{width:0,height:0};var a=this.options.align.split(' ',2);var ax=a[0];var ay=(a[1])?a[1]:'bottom';switch(ax){case'left':break;case'center':x+=(ed.width/2);break;case'right':x+=ed.width;break;default:if(!isNaN(ax)){x+=parseInt(ax);}
break;}
switch(ay){case'top':break;case'middle':y+=(ed.height/2);break;case'bottom':y+=ed.height;break;default:if(!isNaN(ay)){y+=parseInt(ay);}
break;}}
this.tooltip.setStyle({left:x+'px'});this.tooltip.setStyle({top:y+'px'});},observe:function(element){if(this.options.showOn=='mouseover'||this.options.showOn=='mousemove')element.observe('mouseover',this.click.bindAsEventListener(this,element));if(this.options.showOn=='mousemove')element.observe('mousemove',this.mousemove.bindAsEventListener(this,element));if(this.options.showOn=='click')element.observe('click',this.click.bindAsEventListener(this,element));else if(this.options.hideOn=='mouseout')element.observe('mouseout',this.hide.bindAsEventListener(this,element));}});var BlockSelect=Class.create({initialize:function(target){if(Object.isElement(target)){this.target=target;this.observe();}else{Event.observe(window,'load',function(){this.target=$(target);this.observe();}.bindAsEventListener(this));}},observe:function(el){if(this.target){this.target.observe('click',this.click.bindAsEventListener(this));}},click:function(event){var el=event.findElement('.block-select');if(el&&!el.hasClassName('selected')){this.removeAllSelected();el.addClassName('selected');el.select('.block-select-item').each(function(item){this.checkItem(item);}.bind(this));}},checkItem:function(item){if(item.nodeName=='INPUT'&&(item.type=='radio'||item.type=='checkbox')){item.checked=true;}else if(item.nodeName=='DIV'){item.show();}},uncheckItem:function(item){if(item.nodeName=='INPUT'&&(item.type=='radio'||item.type=='checkbox')){item.checked=false;}else if(item.nodeName=='DIV'){item.hide();}},removeAllSelected:function(){this.target.select('.block-select').invoke('removeClassName','selected');this.target.select('.block-select-item').each(function(item){this.uncheckItem(item);}.bind(this));}});

//Dynamic Slides
var od_slides = new Array();
var od_links = new Array();
var od_notes = new Array();

var od_eq = 0;

var od_pfad = "/mscontent/Image/ohc_dynamic/";

//od_slides definieren 80x72px

od_slides[0] = "f0.gif";
od_slides[1] = "f1.gif";
od_slides[2] = "f2.gif";
od_slides[3] = "f3.gif";
od_slides[4] = "f4.gif";
od_slides[5] = "f5.gif";
od_slides[6] = "f6.gif";
od_slides[7] = "f7.gif";
od_slides[8] = "f8.gif";
od_slides[9] = "f9.gif";
od_slides[10] = "f10.gif";
od_slides[11] = "f11.gif";
od_slides[12] = "f12.gif";
od_slides[13] = "f13.gif";
od_slides[14] = "f14.gif";
od_slides[15] = "f15.gif";

//od_links zu od_slides

od_links[0] = "http://www.ohc24.ch/de/categories/hobby-und-freizeit/freizeit";
od_links[1] = "http://www.ohc24.ch/de/categories/haus-und-haushalt/tresor";
od_links[2] = "http://www.ohc24.ch/de/categories/peripherie/kopfhoerer--microfon?sort=price%7Cdesc";
od_links[3] = "http://www.ohc24.ch/de/search?q=lego&sort=price%7Cdesc";
od_links[4] = "http://www.ohc24.ch/de/categories/haus-und-haushalt/werkzeug--und--garten?sort=price%7Cdesc";
od_links[5] = "http://www.ohc24.ch/de/categories/bueromaterial-482/ordner--ablage";
od_links[6] = "http://www.ohc24.ch/de/search?q=dyson&sort=price%7Cdesc";
od_links[7] = "http://www.ohc24.ch/de/search?q=weihna";
od_links[8] = "http://www.ohc24.ch/de/categories/hobby-und-freizeit/uhren?sort=price%7Cdesc";
od_links[9] = "http://www.ohc24.ch/de/categories/haus-und-haushalt/hygiene-und-gesundheit?sort=price%7Cdesc";
od_links[10] = "http://www.ohc24.ch/de/categories/haus-und-haushalt/hygiene-und-gesundheit?keywords=&pfrom=&pto=&filter=2192&sort=price%7Cdesc";
od_links[11] = "http://www.ohc24.ch/de/categories/literatur--buecher";
od_links[12] = "http://www.ohc24.ch/de/categories/hobby-und-freizeit/r--c--modellbau?sort=price%7Cdesc";
od_links[13] = "http://www.ohc24.ch/de/search?q=gp+batt";
od_links[14] = "http://www.ohc24.ch/de/search?q=CONTOUR+hd&sort=price%7Cdesc";
od_links[15] = "http://www.ohc24.ch/de/categories/audio--foto--video--tv--beamer/beamer--projektoren/beamer";

//Beschreibung zu od_slides

od_notes[0] = "Hobby und Freizeit";
od_notes[1] = "Tresor Techik";
od_notes[2] = "Kopfhoerer und Microfonen";
od_notes[3] = "Lego";
od_notes[4] = "Werkzeug";
od_notes[5] = "Bueromaterial";
od_notes[6] = "Dyson Staubsauger";
od_notes[7] = "Weihnachtsartikel, Weihnachtsbeleuchtung";
od_notes[8] = "Uhren, Casio";
od_notes[9] = "Hygiene und Gesundheit, Rasier-Geraete";
od_notes[10] = "Mundhygiene";
od_notes[11] = "Literatur, Buecher";
od_notes[12] = "Modellbau";
od_notes[13] = "Akkus, Battarien";
od_notes[14] = "Contour HD";
od_notes[15] = "Beamer";

var od_count = Math.floor(Math.random()*(od_slides.length-3));


var preloadimg = new Array()
for (i=0;i<od_slides.length;i++){
	preloadimg[i] = new Image();
	preloadimg[i].src = od_pfad + od_slides[i];
}


function applyslide(obj, dir){
	if (document.all && obj.filters)
	{
		if(od_eq == 0)
		{
			if(dir == 0) // backwards
			{
				od_eq = 6;
			}
			else // forwards
			{
				od_eq = 7;
			}

		}
		
		obj.filters.revealTrans.Transition = od_eq;
			 
		obj.filters.revealTrans.stop();
		obj.filters.revealTrans.apply();
	}
}



function playslide(obj){
	if (document.all && obj.filters)
	{
		obj.filters.revealTrans.play();
	}
}


function backwards(){
	od_eq = 0;
	offset = 0;
	od_count=od_count-4;
	for(k=0;k<4;k++)
	{
		if (od_count+k < 0)
		{
			offset = od_slides.length;
		}
		else if (od_count+k >= od_slides.length)
		{
			offset = od_slides.length*-1;
		}
		else
		{
			offset = 0;
		}
		applyslide(document.images["photoslider"+k],0);
		document.images["photoslider"+k].src= od_pfad + od_slides[od_count+k+offset];
		document.images["photoslider"+k].alt=od_notes[od_count+k+offset];
		document.images["photoslider"+k].title=od_notes[od_count+k+offset];
		playslide(document.images["photoslider"+k]);
		//alert("od_count: "+od_count+" k: "+k+" offset: "+offset);
	}
	if(od_count <= -4)
	{
		od_count = od_slides.length-od_count;
	}

}

function forwards(){
	od_eq = 0;
	offset = 0;
	od_count=od_count+4;
	for(k=0;k<4;k++)
	{
		if (od_count+k >= od_slides.length)
		{
			offset = od_slides.length;
		}
		else if (od_count+k < 0)
		{
			offset = od_slides.length*-1;
		}
		else
		{
			offset = 0;
		}
		applyslide(document.images["photoslider"+k],1);
		document.images["photoslider"+k].src =  od_pfad + od_slides[od_count+k-offset];
		document.images["photoslider"+k].alt=od_notes[od_count+k-offset];
		document.images["photoslider"+k].title=od_notes[od_count+k-offset];
		playslide(document.images["photoslider"+k]);
		
	}
	if(od_count >= od_slides.length)
	{
		od_count = od_count-od_slides.length;
	}
	
}

function golink(c){
	if(c >= od_slides.length)
	{
		c = od_slides.length-c;
	}
	if(c < 0)
	{
		c = od_slides.length+c;
	}
	window.location.href=od_links[c];
}

var s_ohc = "";

function fill_dynamic()
{
	s_ohc = '<a href="#" onClick="backwards();return false;"><img src="'+od_pfad+'back.gif" border="0" /></a>';
	s_ohc = s_ohc +	'<a href="javascript:void(0)" onclick="golink(od_count)">';
	s_ohc = s_ohc +	'<img src="'+od_pfad+od_slides[0+od_count]+'" name="photoslider0" alt="'+od_notes[0+od_count]+'" title="'+od_notes[0+od_count]+'" style="filter:revealTrans(duration=1,transition=23)" border=0>';
	s_ohc = s_ohc +	'</a>';
	s_ohc = s_ohc +	'<a href="javascript:void(0)" onclick="golink(od_count+1)">';
	s_ohc = s_ohc +	'<img src="'+od_pfad+od_slides[1+od_count]+'" name="photoslider1" alt="'+od_notes[1+od_count]+'" title="'+od_notes[1+od_count]+'" style="filter:revealTrans(duration=1,transition=23)" border=0>';
	s_ohc = s_ohc +	'</a>';
	s_ohc = s_ohc +	'<a href="javascript:void(0)" onclick="golink(od_count+2)">';
	s_ohc = s_ohc +	'<img src="'+od_pfad+od_slides[2+od_count]+'" name="photoslider2" alt="'+od_notes[2+od_count]+'" title="'+od_notes[2+od_count]+'" style="filter:revealTrans(duration=1,transition=23)" border=0>';
	s_ohc = s_ohc +	'</a>';
	s_ohc = s_ohc +	'<a href="javascript:void(0)" onclick="golink(od_count+3)">';
	s_ohc = s_ohc +	'<img src="'+od_pfad+od_slides[3+od_count]+'" name="photoslider3" alt="'+od_notes[3+od_count]+'" title="'+od_notes[3+od_count]+'" style="filter:revealTrans(duration=1,transition=23)" border=0>';
	s_ohc = s_ohc +	'</a>';
	s_ohc = s_ohc +	'<a href="#" onClick="forwards();return false;"><img src="'+od_pfad+'next.gif" border="0" /></a>';
	document.getElementById("ohc_dynamic").innerHTML = s_ohc;
}

var TimeoutId = window.setTimeout("fill_dynamic()", 500);

//End dynamic slides
