//<script type="text/javascript">
window.doc_left = 0;var oe=function(Fehler,Datei,Zeile){alert('Es ist der JS- Fehler: '+Fehler+', in der Datei: '+Datei+', in der Zeile: '+Zeile+'Aufgetreten.');};
var oe2=function(){return true;};
window.onerror=oe2;
window.opera = window['opera'];
function $OBJ(id, Doc) {
	return typeof id == 'string' ? (Doc||document).getElementById(id) : id == 'object' ? id : null;
};
var $TAG = function(Tag,Parent)
{// TOM:: Hiermit zieht man bestimmte tags als Objekte, auch mit Angabe eines bestimmten Parents möglich
	Tag=Tag?Tag:'*';
	return ((Tag=='*') && !document.getElementsByTagName('*').length)?(Parent||document).all:(Parent||document).getElementsByTagName(Tag);
}
var $CLASS = function(className, Tag)
{// TOM:: Hiermit zieht man alle tags mit einem bestimmten className als Objekte, auch mit Angabe eines bestimmten Tags möglich
    var muster = new RegExp("(^| )" + className + "($| )");
    var alles = $TAG();
    var gefunden = [];
	for(i=0;i<alles.length;i++){
		if (alles[i].tagName && (alles[i].tagName.toLowerCase() == Tag) && alles[i].className && (alles[i].className != "")) {
            if (alles[i].className.match(muster)) {
                gefunden[gefunden.length] = alles[i];
			}
        }
	}
    return gefunden;
};
function $ARRAY(Obj)
{// TOM:: Hiermit konvertiert man zu einem Array, zB aus nem Objectrange ein Array machen, damit man alle funktionen eines Arrays sicher anwenden kann..
	var ret = [];
	for(var i=0;i<Obj.length;i++){
		ret[i] = Obj[i];
	}
	return ret;
}
function makeHiddenField(Form,Name,Value){
	if($OBJ(Name)){
		var myHidd = $OBJ(Name);
	}
	else{
		var myHidd=Form.appendChild(document.IE==true?document.createElement('<INPUT TYPE=HIDDEN />'):document.createElement('input'));
		if(!document.IE){
			myHidd.setAttribute('type','hidden');
		}
		myHidd.id=Name;
		myHidd.name=Name;
	}
	myHidd.value=Value;
}
var trim = function (val){
	return !val? '' : val.replace(/\s+$/,'').replace(/^\s+/,'');
}
var $GLOBALS = {};
if(navigator.appVersion.match(/MSIE/)&&!navigator.appVersion.match(/Macintosh/)&&!opera&&!navigator.appVersion.match(/Konqueror/)){
	if(!navigator.appVersion.match(/MSIE 7/)){
		$GLOBALS.IE=true;
		if(navigator.appVersion.match(/MSIE 8/))$GLOBALS.IE7=true;
	}
	else{
		$GLOBALS.IE7=true;
	}
}
function init()
{
	var anker = null;
	if($OBJ('sprachen') && (navigator.appName=='Netscape') && (typeof navigator.mozIsLocallyAvailable == 'undefined')){
		$OBJ('sprachen').style.top = '1px';
	}
	if(navigator.userAgent.indexOf('Safari') != -1 || window.opera){
		$OBJ('sprachen').style.top = window.opera ? '-2px' : '-1px';
		if(navigator.userAgent.indexOf('Chrome') != -1){
			$OBJ('sprachen').style.top = '0px';
		}
	}
	var parts = $TAG('div', document.body);
	for(var i=0;i<parts.length;i++){
		if(parts[i].className == 'part'){
			parts[i].style.zIndex = 20 - i;
		}
	}
        
        var removeWrongSlideLink = function(){
            var highslideContent = $CLASS('highslide_container','div');
            if(highslideContent.length && highslideContent[0].firstChild){
                var remove = highslideContent[0].nextSibling;
                //highslideContent[0].parentNode.removeChild(remove);
                remove.style.display = 'none';
            }
            else if(highslideContent.length){
                remove = highslideContent[0];
                //highslideContent[0].parentNode.removeChild(remove);
                remove.style.display = 'none';
            }
            if(highslideContent.length && highslideContent[1] && highslideContent[1].firstChild){
                remove = highslideContent[1].nextSibling;
                //alert(remove);
                //highslideContent[1].parentNode.removeChild(remove);
                remove.style.display = 'none';
            }
            else if(highslideContent.length && highslideContent[1]){
                remove = highslideContent[1];
                //highslideContent[1].parentNode.removeChild(remove);
                remove.style.display = 'none';
            }
        };
        setTimeout(removeWrongSlideLink,20);
	if($CLASS('innerLupe','div')[0] && (anker = $CLASS('innerLupe','div')[0])){
            var preImg = null;
            var preImg2 = null;
            if((preImg = anker.parentNode.parentNode.parentNode.firstChild.firstChild.lastChild) && preImg.src){
                var a = document.createElement('a');
                a.setAttribute('href', preImg.src);
                anker.appendChild(a);
                a.className = 'highslide'; // new
                a.onclick = function (){hs.marginBottom = 130;if($CLASS('highslide_container','div')[1].style.display == 'none')hs.marginBottom = 40;return hs.expand(this, {wrapperClassName: 'highslide-no-border', dimmingOpacity: 0.75, align: 'center'});}
                a.title = preImg.title;
                var img = document.createElement('img'); // new
                img.src = '/images/blank.gif'; // new
                a.appendChild(img); // new
                $TAG('img', $TAG('td',$OBJ('body'))[0])[0].parentNode.onclick=function(){
                    $TAG('img', $TAG('td',$OBJ('body'))[1])[0].parentNode.onclick();
                }
            }
            if($CLASS('innerLupe','div')[1] && (anker = $CLASS('innerLupe','div')[1])){
                if((preImg2 = anker.parentNode.parentNode.parentNode.firstChild.firstChild.lastChild) && preImg2.src){
                    var a = document.createElement('a');
                    a.setAttribute('href', preImg2.src);
                    anker.appendChild(a);
                    a.className = 'highslide' // new
                    a.onclick = function (){hs.marginBottom = 130;if($CLASS('highslide_container','div')[1].style.display == 'none')hs.marginBottom = 40;return hs.expand(this, {wrapperClassName: 'highslide-no-border', dimmingOpacity: 0.75, align: 'center'});}
                    a.title = preImg2.title;
                    var img = document.createElement('img'); // new
                    img.src = '/images/blank.gif'; // new
                    a.appendChild(img); // new
                }
                try{
                    $TAG('img', $TAG('td',$OBJ('body'))[2])[0].parentNode.onclick=function(){
                        $TAG('img', $TAG('td',$OBJ('body'))[3])[0].parentNode.onclick();
                    }
                }
                catch (e){};
            }
	}
	if($CLASS('etikettcont','div')[0]){
		var divs = $ARRAY($CLASS('etikettcont','div'));
		var a = null;
		var src = '';
                var h2 = null;
		for(var i=0;i<divs.length;i++) {
                        if((h2 = divs[i].getElementsByTagName('h2')[0])){
                            if(divs[i].getElementsByTagName('h2')[0].offsetHeight>18){
                                divs[i].getElementsByTagName('table')[0].style.top = '40px';
                            }
                        }
			if((a = $CLASS('highslide','a')[i]) && (src = trim(a.href))){
				var img = document.createElement('img');
				img.style.height='238px';
				img.style.margin = '10px 10px 10px 20px';
				img.style.width = '83px';
                                img.style.padding = '0 6px';
                                img.style.border='1px solid #b62e22';
				img.src = src;
				a.removeChild(a.firstChild);
				a.appendChild(img);
                                a.style.visibility = 'visible';
				a.onclick = function (){return hs.expand(this, {wrapperClassName: 'highslide-no-border', dimmingOpacity: 0.75, align: 'center'});}
			}
		}
	}
	var div = document.createElement('a');
	//div.style.backgroundColor = '#000';
	div.style.position='absolute';
	div.style.left='785px';
	div.style.top='25px';
	div.style.width = '8px';
	div.style.height = '8px';
	div.style.display = 'block';
	div.style.cursor = 'default';
	div.href='/manager/';
	$OBJ('doc').appendChild(div);
        div = document.createElement('a');
	div.style.position='absolute';
	div.style.left='803px';
	div.style.top='8px';
	div.style.width = '8px';
	div.style.height = '8px';
	div.style.display = 'block';
	div.style.cursor = 'default';
	div.href='/gallery.php';
	$OBJ('doc').appendChild(div);
	hideLinkFocus();
	div = $TAG('div',$OBJ('content'));
	for(i=0;i < div.length;i++) {
		if((div[i].className.indexOf('teaser')==0 || div[i].className=='teaser' || div[i].className=='etikettcont' || div[i].className=='employee' || div[i].id=='body' || div[i].className=='contact') && div[i].className!='teaserText') {
			if(div[i].style.display == 'none'){
				continue;
			}
			a = $TAG('a', div[i]);
			var ctr = 0;
			for(var ii=0;ii < a.length;ii++) {
				if(a[ii].className == 'QE_Link') {
					a[ii].style.top = (ctr*17+((div[i].className=='employee')?78:0)) - Math.round(ctr/6*1.5) + 'px';
					if(div[i].id=='body' && !($OBJ('lupe'))){
						a[ii].style.top = (((ctr%10)*17) + 14) + 'px';
					}
					if($GLOBALS.IE7 && div[i].id=='body' && ($TAG('td',div[i]) && $TAG('td',div[i])[1] && $TAG('td',div[i])[1].className && ($TAG('td',div[i])[1].className == 'lupe')) && (a[ii] == $TAG('a',$TAG('td',div[i])[1])[0])){
						a[ii].style.top = $OBJ('tvsubhead_1') ? '23px' : '49px';
					}
					if($GLOBALS.IE7 && div[i].id=='body' && ($TAG('td',div[i]) && $TAG('td',div[i])[3] && $TAG('td',div[i])[3].className && ($TAG('td',div[i])[3].className == 'lupe')) && (a[ii] == $TAG('a',$TAG('td',div[i])[3])[0])){
						a[ii].style.top = $OBJ('tvsubhead_2') ? '23px' : '49px';
					}
					ctr++;
					if((div[i].className=='employee') && (((ctr < 6) && (ctr%6==0)) || ((ctr > 5) && ((ctr+1)%7==0)))){
						ctr++;
					}
					if($GLOBALS.IE7 && (div[i].className=='etikettcont')){
						if(ctr>2&&ctr<11){
							a[ii].style.left = '-125px';
						}
						if(ctr==3)a[ii].style.top = '10px';
						if(ctr==4)a[ii].style.top = '27px';
						if(ctr==5)a[ii].style.top = '44px';
						if(ctr==6)a[ii].style.top = '61px';
						if(ctr==7)a[ii].style.top = '78px';
						if(ctr==8)a[ii].style.top = '95px';
						if(ctr==9)a[ii].style.top = '112px';
						if(ctr==10)a[ii].style.top = '129px';
						if(ctr==11)a[ii].style.top = '170px';
					}
				}
			}
		}
		else if(div[i].className=='teaserText' && $TAG('a',div[i])[0]){
			$TAG('a',div[i])[0].style.top = '-17px';
		}
	}
	var a=$TAG('a');
	for(i=0;i < a.length;i++){
		if(a[i].href==document.referrer) {
			if(!!a[i].onclick && a[i].onclick != window.undefined){
				a[i].onclick();
			}
			break;
		}
	}
	floatDoc();
	if($OBJ('QE_Toolbar')){
		var as = $TAG('a',$OBJ('QE_Toolbar'));
		for (i=0;i<as.length;i++){
			if(as[i].firstChild){
				as[i].title = as[i].title.replace('Bearbeiten ','');
			}
		}
	}
	if($OBJ('map')){
        window.googleload = function () {
          if (GBrowserIsCompatible()) {
            var map = new GMap2($OBJ('map'));
            var geocoder = new GClientGeocoder();
            window.showAddress = function(address) {
              geocoder.getLatLng(
                address,
                function(point) {
                  if (!point) {
                    alert(address + " nicht gefunden");
                  } else {
                    map.setCenter(point, 9);
					var marker2 = new GMarker(new GLatLng(41.8990, 45.5440));
					map.addOverlay(marker2);
					var marker3 = new GMarker(new GLatLng(42.0500, 45.4640));
					map.addOverlay(marker3);
					var marker4 = new GMarker(new GLatLng(41.9660, 45.7200));
					map.addOverlay(marker4);
					var myInnerHTML2 = '<div align="left" style="white-space:nowrap;"><img src="/assets/images/Mitarbeiter/burkhard_schuchmann.jpg" height="48" style="margin:4px 10px 0 0;" align="left" /><strong style="display:block;padding-bottom:4px;">Weinanbaugebiet</strong>Schuchmann Wines Georgia<br />Kisiskhevi<br /><a href="mailto:info@schuchmann-wines.com">info@schuchmann-wines.com</a></div>';
					var myInnerHTML3 = '<div align="left" style="white-space:nowrap;"><img src="/assets/images/Mitarbeiter/burkhard_schuchmann.jpg" height="48" style="margin:4px 10px 0 0;" align="left" /><strong style="display:block;padding-bottom:4px;">Weinanbaugebiet</strong>Schuchmann Wines Georgia<br />Napareuli<br /><a href="mailto:info@schuchmann-wines.com">info@schuchmann-wines.com</a></div>';
					var myInnerHTML4 = '<div align="left" style="white-space:nowrap;"><img src="/assets/images/Mitarbeiter/burkhard_schuchmann.jpg" height="48" style="margin:4px 10px 0 0;" align="left" /><strong style="display:block;padding-bottom:4px;">Weinanbaugebiet</strong>Schuchmann Wines Georgia<br />Shilda<br /><a href="mailto:info@schuchmann-wines.com">info@schuchmann-wines.com</a></div>';
					GEvent.addListener(marker2, "click", function() {
                        marker2.openInfoWindowHtml(myInnerHTML2);
                    });
					GEvent.addListener(marker3, "click", function() {
                        marker3.openInfoWindowHtml(myInnerHTML3);
                    });
					GEvent.addListener(marker4, "click", function() {
                        marker4.openInfoWindowHtml(myInnerHTML4);
                    });
					GEvent.addListener(marker2, "infowindowclose", function() {
                        map.panTo(point, 8);
                    });
					GEvent.addListener(marker3, "infowindowclose", function() {
                        map.panTo(point, 8);
                    });
					GEvent.addListener(marker4, "infowindowclose", function() {
                        map.panTo(point, 8);
                    });
                    map.addControl(new GLargeMapControl());
                    map.addControl(new GMapTypeControl());
					map.addMapType(G_PHYSICAL_MAP);
                    map.addControl(new GScaleControl());
					map.setMapType(G_PHYSICAL_MAP);
                  }
                }
              );
        window.korrekturMapLeiste = function()
        {
          if($OBJ('amtc_option_0')){
                $TAG('div', $OBJ('amtc_option_0'))[0].firstChild.data = '';
                $OBJ('amtc_option_0').title = '';
                $OBJ('amtc_option_0').style.visibility = 'visible';
                $TAG('div', $OBJ('amtc_option_1'))[0].firstChild.data = '';
                $OBJ('amtc_option_1').title = '';
                $OBJ('amtc_option_1').style.visibility = 'visible';
                $TAG('div', $OBJ('amtc_option_2'))[0].firstChild.data = '';
                $OBJ('amtc_option_2').title = '';
                $OBJ('amtc_option_2').style.visibility = 'visible';
                $TAG('div', $OBJ('amtc_option_3'))[0].firstChild.data = '';
                $OBJ('amtc_option_3').title = '';
                $OBJ('amtc_option_3').style.visibility = 'visible';
          }
        }
        window.tmr2 = window.setInterval(function(){if($OBJ('amtc_option_0') && $TAG('div', $OBJ('amtc_option_0')) && $TAG('div', $OBJ('amtc_option_0'))[0] && $TAG('div', $OBJ('amtc_option_0'))[0].firstChild && $TAG('div', $OBJ('amtc_option_0'))[0].firstChild.data){window.korrekturMapLeiste();window.clearInterval(window.tmr2);}},50);
            }
            window.showAddress('Telavi, Georgia');
          }
        }
        if(window['GUnload'])window.onunload = window['GUnload'];
        if(window['GUnload'])window.setTimeout(function(){window.googleload();}, 200);
   }
}
function changeOpac(opacity, Obj) {
    var object = Obj.style;
   	if($GLOBALS.IE||$GLOBALS.IE7){
		object.filter = "alpha(opacity=" + opacity + ")";
	}
   	else {
		object.opacity = (opacity / 100);
		object.MozOpacity = (opacity / 100);
		object.KhtmlOpacity = (opacity / 100);
	}
}
function floatDoc()
{
	document.getElementById('doc').style.visibility='visible';	}
function hideLinkFocus()
{
    if(!!window.QuickEdit === false) {
            window.QuickEdit = false;
    }
    var a=$TAG('a');
    for(var i=0;i < a.length;i++){// http://www.tomislav.net/gestrichelte-linie-um-link-verstecken.htm
        a[i].onmousedown=function(){this.onfocus=function(){this.blur()}}
        a[i].onmouseout=function(){this.onfocus=function(){}}
        a[i].onmouseup=a[i].onmouseout;
        if(a[i].className=='QE_Link' && !window.QuickEdit) {
                a[i].style.display = 'none';
        }
        if(a[i].id && (a[i].id.indexOf('fPlayer')>-1)){
            $f(a[i].id).onLoad(function(){
                return false;
            }).onPause(function(){
                if (this.isFullscreen()) {
                   this.toggleFullscreen();
                }
            }).onFinish(function(){
                this.unload();
            });
        }
        if(a[i] && a[i].href && (a[i].href.indexOf('#flv') > -1)){
            $GLOBALS.aI = a[i];
            var flaTd = a[i].parentNode.parentNode.parentNode.getElementsByTagName('tr')[1].firstChild;
            flaTd.className = 'lupe flaCur' + ($OBJ('tvsubhead_1',document) ? ' extra' : '');
            var im = document.createElement('img');
            flaTd.firstChild.appendChild(im);
            im.src='/images/blank.gif';
            im.style.cursor = 'url(/highslide/graphics/zoomin.cur), pointer';
            im.onclick = function(){
               $GLOBALS.aI.onclick();
            }
        }
    }
}
window.onload = init;
//</script>
