var webImagePathZoom = '/images/data/vnw9';
function sendMMS(myImage) {
	var mywurl = 'http://www.schaeferlauf24.de' + webImagePathZoom + '/' +  myImage;
	var w = 421;
	var h = 561;
	var l = Math.floor((screen.availWidth / 2) - (w / 2));
	var t = Math.floor((screen.availHeight / 2) - (h / 2));
	var win = this.window.open('http://www.foto2handy.de/index.php?PID=38&URL='+mywurl,'foto2handy','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,left=' + (l) + ',top=' + (t) + ',width=' + (w) + ',height=' + (h));
	win.focus();

}
function quick_zoom(myImageSrc,width,height) {
	if(width<0) width=330;
	if(height<0) height=330;
	elem = document.getElementById('content_quick_zoom');
	elem.style.width = 'auto';
	elem.style.height = 'auto';
	elem.style.left = getScreenWidth()-width-25;//(984-width)/2;
	elem.style.top = (getScreenHeight()-height)/2+getOffsetY();

	var s_shadowBoxTitle = 'Bild in den Warenkorb legen';
	var s_shadowBoxOptions = 'shadowbox;width=500;height=400;player=iframe;';

	var strContent = '';
	strContent += '<div style="text-align: right; padding: 0 4px 0 0;">';
	strContent += '		<span style="float:left;">Fahren Sie mit der Maus über die Bilder</span><a href="javascript:quick_zoom_close();"><img src="/images/page/ico_err.gif" border="0" width="12" height="14"></a>';
	strContent += '</div>';
	strContent += '<div style="clear:both;background-position:center;background-repeat:no-repeat;background-image:url(\''+webImagePathZoom+'/'+myImageSrc+'\');height:'+height+'px;width:'+width+'px;"><img src="'+webImagePathZoom+'/showImageLayer4b76.gif" width="'+width+'" height="'+height+'" border="0" galleryimg="no"></div>';
	elem.innerHTML = strContent;
	elem.style.display = 'block';
}
function addToBasketSb(myImageSrc,s_shadowBoxTitle,SESSNAME,SESSID) {
	Shadowbox.open({
		content:'addToBasket.php?addPic=' + myImageSrc + '&' + SESSNAME + '=' + SESSID,
		player:'iframe',
		title:s_shadowBoxTitle,
		height:400,
		width:500
	});
}

function quick_zoom_hover(myImageSrc,width,height,SESSNAME,SESSID) {
	elem = document.getElementById('content_quick_zoom');
	if(elem.style.display == 'block') {
		quick_zoom(myImageSrc,width,height,SESSNAME,SESSID);
	}
}

function quick_zoom_close(myImage) {
	elem = document.getElementById('content_quick_zoom');
	elem.style.width = '0px';
	elem.style.height = '0px';
	elem.style.display = 'none';
}
function zoom(myImage,SESSNAME,SESSID,simple,title) {
	var paramSimple = "";
	if(simple == true) {
		paramSimple = "&simple="+simple;
	}
	if(title == null) {
		title = 'Blätterzoom';
	}
	
	Shadowbox.open({
		content:'zoom.php?showPic='+myImage+'&'+SESSNAME+'='+SESSID+paramSimple,
		player:'iframe',
		title:title,
		height:550,
		width:540
	});
	
	return;
	

	var properities = "width=540,height=520,statusbar=0,status=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,copyhistory=0";
	newfenster = window.open("zoom.php?"+SESSNAME+"="+SESSID+paramSimple+"&showPic="+myImage,"zoom",properities);
	newfenster.focus();
}
function zoomGetPic(myImage,SESSNAME,SESSID) {
	myURL = 'zoom.php?'+SESSNAME+'='+SESSID+'&showPic='+myImage;
	go(myURL);
}
function addToBasket(myImage,SESSNAME,SESSID) {
	var properities = "width=500,height=370,statusbar=0,status=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0";
	newfenster = window.open("addToBasket.php?"+SESSNAME+"="+SESSID+"&addPic="+myImage,"basket",properities);
	newfenster.focus();
}
function changeBasketItem(myItem,SESSNAME,SESSID) {
	var properities = "width=500,height=370,statusbar=0,status=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0";
	newfenster = window.open("addToBasket.php?"+SESSNAME+"="+SESSID+"&changeItem="+myItem,"basket",properities);
	newfenster.focus();
}

function go(myURL) {
	if(myURL != 'spacer') {
		window.location.href = myURL;	
	}
}

function openTermsDownload() {
	Shadowbox.open({
		player:"iframe",
		content:"/app/terms_filedownload.php",
		height:350,
		width:500,
		title:"Nutzungsbedingungen"
	});
}

function openTerms() {
	openTermsDownload();
}
function openShipping() {
	Shadowbox.open({
		player:"iframe",
		content:"/app/terms_shipping.php",
		height:350,
		width:500,
		title:"Versandkosten"
	});
}

function openOrderfee() {
	Shadowbox.open({
		player:"iframe",
		content:"/app/terms_orderfee.php",
		height:350,
		width:500,
		title:"Bearbeitungspauschale"
	});
}
function reloadMainWindow() {
	if (opener != null) {
		if (!opener.closed) {
			mainwin = opener;
		}
	} else {
		mainwin = parent;
	}

	if (mainwin == null) {
		mainwin = window.open("", "schaeferlauf24_main");
	}
	if (mainwin != null) {
		mainwin.location.reload();
	}
}
function loadMainWindow(myURL) {
	mainwin = parent;
	if (mainwin.Shadowbox == null || mainwin.Shadowbox == 'undefined') {
		mainwin = window.open("", "schaeferlauf24_main");
	}
	if (mainwin != null) {
		mainwin.location.replace(myURL);
	}
}


function open_window_sizeable(myURL, BARS, WIDTH, HEIGHT)  {
  var eigenschaften = "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=" + BARS + ",resizable=yes,copyhistory=0,width=" + WIDTH + ",height=" + HEIGHT;
  newfenster = window.open(myURL,"openwindow", eigenschaften);
  newfenster.focus();
}

function CheckLen(Target, TargetField) {
  maxLength = 1000;
  StrLen = Target.value.length;
  if (StrLen == 1 && Target.value.substring(0,1) == " ") {
    Target.value = "";
    StrLen = 0;
  }
  if (StrLen > maxLength ) {
    Target.value = Target.value.substring(0,maxLength);
    alert("Die Maximale Zeichenanzahl erreicht.");
    CharsLeft = 0;
  }
  else {
    CharsLeft = maxLength - StrLen;
  }
  TargetField.value = CharsLeft;
}

function preview(adresse,name,w,h) {
  newwin=window.open(adresse,name,'width='+w+','+'height='+h+',scrollbars=yes');
  newwin.focus();
  self.name="xx"+name;
}

function positionWindow(align,valign) {
	if(navigator.appName.indexOf("Microsoft")!=-1){
	   ysize=document.body.offsetHeight;
	   xsize=document.body.offsetWidth;
	} else {
	  ysize=window.innerHeight;
	  xsize=window.innerWidth;
	}

	switch(align) {
		case "left":
			x_pos = 0;
			break;
		case "center":
			x_pos = (screen.width-xsize)/2;
		    break;
		case "right":
	  		x_pos = (screen.width-xsize);
			x_pos = x_pos - 8;
	    	break;
	  default:
	  		x_pos = (screen.width-xsize);
	    break;
	}
	switch(valign) {
		case "top":
			y_pos = 0;
			break;
		case "middle":
			y_pos = (screen.height-ysize)/2;
		    break;
		case "bottom":
	  		y_pos = (screen.height-ysize);
			y_pos = y_pos - 70;
	    	break;
	  default:
	  		y_pos = 0;
	    break;
	}
	self.moveTo(x_pos,y_pos);
}


function getOffsetY() {
	if(self.pageYOffset) {
		// all except Explorer
		return self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop) {
		// Explorer 6 Strict
		return document.documentElement.scrollTop;
	} else if (document.body) {
		// all other Explorers
		return document.body.scrollTop;
	} else {
		return 0;
	}
}

function getScreenHeight() {
	if (self.innerHeight) {
		return self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		return document.documentElement.clientHeight;
	} else if (document.body) {
		return document.body.clientHeight;
	}
}

function getScreenWidth() {
	if (self.innerWidth) {
		return self.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth) {
		return document.documentElement.clientWidth;
	} else if (document.body) {
		return document.body.clientWidth;
	}
}
