﻿// ImageZoom - Begin

function OpenPictureLayer(divImageZoom, ImageID, ImageTagID, pfad) {
	d = document.getElementById(divImageZoom);
	d.style.visibility = 'visible';

	var flashvars = {};
	var params = {};
	params.menu = "false";
	params.quality = "high";
	var attributes = {};
	swfobject.embedSWF("/flash/imagezoom/ProCompImageZoom.swf?ImagePath=/ImageZoom/" + ImageID + "/", "FlashImageZoomLayer", "450px", "450px", "9.0.0", false, flashvars, params, attributes);
	if (document.images[ImageTagID] == '[object]') document.images[ImageTagID].src = pfad;
}

function ClosePictureLayer(divImageZoom, FlashImageZoomLayer) {

	d = document.getElementById(divImageZoom);
	d.style.visibility = 'hidden';

	e = document.getElementById(FlashImageZoomLayer);
	e.style.visibility = 'hidden';
}

// ImageZoom - End

function open_internerlink_nw(url,w,h)
{
	l = Math.round(screen.width/2)-Math.round(w/2);
	t = Math.round(screen.height/2)-Math.round(h/2);
	window.open(url, '', 'left=' + l + ',top=' + t + ',dependent=no,width=' + w + ',height=' + h + ',menubar=yes,location=yes,status=yes,scrollbars=yes,toolbar=yes,resizable=yes');
}

//function changeimg(bildname,dateiname)
//	{
//	document.images[bildname].src='images/' + dateiname;
//	}

function anker(ankername)
	{
	var quelllink = self.document.location.href
	var linkarr = quelllink.split("#");
	self.document.location.href=linkarr[0]+'#'+ankername;
	}
	
//function showpic(id,picture,width,height)
//{
// window.open('/file/'+id+'_bild_'+picture,'cmspicture'+id,'width='+(width-1)+',height='+(height-1));
//}

function showpic(id, picture, width, height, ext) {
    
    if (ext == undefined) 
    {
        ext = '';        
    }
    else 
    {
        ext = '.' + ext;        
    }
    //alert(ext);
    
    window.open('/file/' + id + '_bild_' + picture + '' + ext, 'cmspicture' + id, 'width=' + (width - 1) + ',height=' + (height - 1));
}



function swapLayers(id) {
	var cur_lyr; // holds id of currently visible layer
	if (cur_lyr) hideLayer(cur_lyr);
	showLayer(id);
	cur_lyr = id;
}

function showLayer(id) {
	var lyr = getElemRefs(id);
	if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
	var lyr = getElemRefs(id);
	if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById) ? document.getElementById(id) : (document.all) ? document.all[id] : (document.layers) ? document.layers[id] : null;
	if (el) el.css = (el.style) ? el.style : el;
	return el;
}

function changeimg(bildname, dateiname) {
	document.images[bildname].src = dateiname;
}

function addBookmark(SeitenURL, SeitenTitel) {

	if (window.sidebar) {
		// firefox
		window.sidebar.addPanel(SeitenTitel, SeitenURL, Kommentar);
	}
	else if (window.opera && window.print) {
		// opera
		var elem = document.createElement('a');
		elem.setAttribute('href', SeitenURL);
		elem.setAttribute('title', SeitenTitel);
		elem.setAttribute('rel', 'sidebar');
		elem.click();
	}
	else if (document.all) {
		// ie
		window.external.AddFavorite(SeitenURL, SeitenTitel);
	}
}

function submitForm(event, TypeID) {
	//event = event || window.event;
	var charCode = event.keyCode;

	if (charCode == 13) {
		__doPostBack(TypeID, '');
	}
}


//function ShowProductDetails(ProductID) {
//	document.getElementById('ctl00_ctl00_cphProductDetails_hidProductDetailsProductID').value = ProductID;
//	__doPostBack('ctl00$ctl00$cphProductDetails$btnShowProductDetails', '');
//}

function ShowProductDetails(ProductID, ClientID) {
	document.getElementById(ClientID).style.visibility = 'visible';	
	//document.getElementById(ClientID).value = ProductID;	
}

function HideProductDetails(ProductID, ClientID) {
	document.getElementById(ClientID).style.visibility = 'hidden';
	//document.getElementById(ClientID).value = ProductID;	
}


