var newwindow;

function MM_openBrWindow(theURL,winName,features) {
  newwindow=window.open(theURL,winName,features);
  if (window.focus) {
    newwindow.focus()
  }
}

function zoom(img)
{
	MM_openBrWindow('/bin/zoom.php?img='+img,'araneszoom','width=537,height=798,scrollbars=1');	
}


function cntpopup(url)
{
	MM_openBrWindow(url,'cntzoom','width=800,height=500,scrollbars=1');	
}

function phpcode2(token)
{
	var output = '';
	output += '<'+'?php '+'echo lg(\''+token+'\');'+' ?'+'>\n';
	output += 'lg(\''+token+'\')\n';
	output += '<'+'?php '+'echo lg(\''+token+'\',\'\',false);'+' ?'+'>\n';
	output += 'lg(\''+token+'\',\'\',false)\n';
	document.getElementById('phpcode').value = output;
}

function mailpopup(url,id,rand) {
	if (rand) {
		id += Math.round(Math.random()*1000000,0);
	}
	MM_openBrWindow(url,'mailpopup'+id,'width=550,height=650,resizable=yes,scrollbars=yes');
	return false;
}

if (typeof (Prototip) != 'undefined') {
	
	Prototip.Styles.mystyle = {
		className: 'mystyle',
		border: 4,
		borderColor: '#99C3FF',
		radius: 4,
		stem: { height: 12, width: 15 }
	}
	Prototip.Styles.topnav = {
			className: 'mytopnstyle',
			border: 0,
			borderColor: '#99C3FF',
			radius: 0,
			stem: { height: 0, width: 0 }
		}
	
	Prototip.Styles.lgselectmenu = {
		className: 'lgselectmenu',
		border: 0,
		borderColor: '#7FB5FF ',
		radius: 0,
		stem: { height: 12, width: 15 }
	}
	
	document.observe('dom:loaded', function() {
		new Tip('lgselectbutton', $('lgselectmenu'), {
			style: 'lgselectmenu',
			className: 'lgselectmenu',
			effect: 'blind',
			hook: { tip: 'topLeft', target: 'bottomLeft' },
			hideOn: false,
			hideAfter: 1,
			offset: { x: -8, y: 0 }
		});
	/*
		$A($$('div#headnav li a span')).each(function(e){
			new Tip(e, {
				ajax: {
					url: '/bin/topnav_tooltip.php',
					options: {
						method:'get',
						parameters: {
							'cms_id': e.className
						}
					}
				},
				style: 'topnav',
				target: 'col3',
				hideOn: false,
				hideAfter: 0.5,
				hook: { tip: 'topLeft', target: 'topLeft' },
				offset: { x: 0, y: 0 }
				
			});
		});
	*/		
	}); 
}

function ChkSelected(){
	
	var goon=true;
	var selectbox=$$('div#articledetailset div.selectbox select.pulldownbox');
	if(selectbox.length){
		for (var i=0; i<selectbox.length; i++) {
			if(selectbox[i].value == 0 || selectbox[i].value == ''){
				goon=false;
			}
			
		}
	}
			
	if(goon == true){
		document.article_set.submit();
	}
	
}

function SelectRadio(div_type,type_id){
	
	if(div_type){
		var radio=document.getElementById('radio_'+div_type);
		if(radio){
			radio.checked = div_type;
			GetSelected(radio,type_id);
		}
	}
	
	
}

function GetSelected(object,type_id){
	
	if(object.value){
		var div=document.getElementById(object.value);
		if(div){
			var div_off=$$('div#articledetailset div#'+type_id+' div.setarticle');
			if(div_off.length){
				for (var i=0; i<div_off.length; i++) {
					div_off[i].className="setarticle";
				}
			}
			var radio_off=$$('div#articledetailset div#'+type_id+' div.setarticle div.radio');
			if(radio_off.length){
				for (var i=0; i<radio_off.length; i++) {
					radio_off[i].className="radio";
				}
			}
			
			var artikel_off=$$('div#articledetailset div#'+type_id+' div.setarticle div.artikelnr');
			if(artikel_off.length){
				for (var i=0; i<artikel_off.length; i++) {
					artikel_off[i].className="artikelnr";
				}
			}
			
			div.className="setarticle active";
			var radio=$$('div#'+object.value+' div.radio')
			if(radio.length){
				for (var i=0; i<radio.length; i++) {
					if(radio[i].className == 'radio'){
						radio[i].className="radio active";
					}
				}
			}
			var artikel=$$('div#'+object.value+' div.artikelnr')
			if(artikel.length){
				for (var i=0; i<artikel.length; i++) {
					if(artikel[i].className == 'artikelnr'){
						artikel[i].className="artikelnr active";
					}
				}
			}
			
		}
	}
}


function setBasketFormfocus(field)
{
    document.getElementById(field).focus();
}

var addthis_config = {
	services_compact: 'misterwong, delicious, google, yahoobkm, live, more, print, email, favorites'
}

