/***********************************************/
/*** EPPENDORF 2005                          ***/
/*** BASIC JAVA SCRIPT FUNCTIONS             ***/
/*** CREATED BY SSM / TURBO D3 GMBH          ***/
/***********************************************/

/***********************************************/
/*** HIDE LAYER (VISIBILITY)                 ***/
/***********************************************/

	function hide(id) {

    	if (document.getElementById(id)) {

         	document.getElementById(id).style.visibility = 'hidden';

         } // END IF

         return undefined;

    } // END FUNCTION

/***********************************************/
/*** SHOW LAYER (VISIBILITY)                 ***/
/***********************************************/

	function show(id) {

    	if (document.getElementById(id)) {

         	document.getElementById(id).style.visibility = 'visible';

         } // END IF

    } // END FUNCTION

/***********************************************/
/*** CHANGE LAYER (VISIBILITY)               ***/
/***********************************************/

	function changeVisibility(id) {

    	if (document.getElementById(id)) {

         	if (document.getElementById(id).style.visibility == 'visible') {

				hide(id);

			} else {

				show(id);

			} // END ELSE

        } // END IF

    } // END FUNCTION

/***********************************************/
/*** SHOW LAYER (DISPLAY)                    ***/
/***********************************************/

	function showDisplay (id) {

	    if (document.getElementById(id)) {

	    	document.getElementById(id).style.display = 'block';

	    } // END IF

    } // END FUNCTION

/***********************************************/
/*** HIDE LAYER (DISPLAY)                    ***/
/***********************************************/

    function hideDisplay (id) {

         if (document.getElementById(id)) {

	    	document.getElementById(id).style.display = 'none';

	    } // END IF


    } // END FUNCTION

/***********************************************/
/*** CHANGE LAYER (DISPLAY)                  ***/
/***********************************************/

    function changeDisplay (id) {

    	if (document.getElementById(id)) {

         	if (document.getElementById(id).style.display == 'none') {

             	showDisplay(id);

             } else {

             	hideDisplay(id);

             } // END ELSE

         } // END IF

    } // END FUNCTION

/***********************************************/
/*** HIDE ALL LAYERS AND SHOW ONE            ***/
/***********************************************/

	function hideandshowDisplay (parentid,hideprefix,showid) {

		var baseLayer = document.getElementById(parentid);
		var objs = baseLayer.getElementsByTagName("div");

		for (i = 0; i < objs.length; i++) {

			idbuffer = objs[i].id;

			if (idbuffer != '') {

				if (idbuffer.match(/hideprefix/) != -1) {

					if (idbuffer == showid) {

						showDisplay(idbuffer);

					} else {

						hideDisplay(idbuffer);

					} // END ELSE

				} // END IF

			} // END IF

		} // END FOR

	} // END FUNCTION

/***********************************************/
/*** CHANGE CSS CLASS BY ID                  ***/
/***********************************************/

	function changecss(id,css) {

    	if (document.getElementById(id)) {

			if (document.getElementById(id).className != css) {

	         	document.getElementById(id).className = css;

			} // END IF

		} // END IF

    } // END FUNCTION

/***********************************************/
/*** CHECK EMAIL                              ***
/***********************************************/

	function checkEmail (email) {

		if (email != '') {

			var reg_email = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([A-Za-z]{2,4})$/;

			if ((reg_email.test(email)) == false) {

				return(false);

			} else {

				return (true);

			} // END ELSE

		} else {

			return (false);

		} // END ELSE

	} // END FUNCTION

/***********************************************/
/*** CHECK NUMERIC                            ***
/***********************************************/

	function checkNumeric (text) {

		var reg_nbr = /(^-?\d\d*$)/;

		if ((reg_nbr.test(text)) == false) {

			return (false);

		} else {

			return (true);

		} // END ELSE

	} // END FUNCTION

/***********************************************/
/*** JUMP WITH ONCLICK                       ***/
/***********************************************/

	function jump (target,mode) {

		switch (mode) {

			case 'content':
				window.location.href = target;
			break;

			case '_self':
				window.location.href = target;
			break;

			case '_blank':
				window.open(target,mode);
			break;

			// OPEN DISTRIBUTOR LIST
			case 'distlist':

				var sh = screen.height;
				var sw = screen.width;

				var wx = (sw / 2) - 140;
				var wy = (sh / 2) - 200;

				newWindow = window.open('../en/meta/ww_frameset.html?' + target + '#','distributorlist','toolbar=no, scrollbars=no,resizable=yes,menubar=yes,width=280,height=400,left='+wx+',top='+wy) ;
				newWindow.focus();
			break;

			// OPEN POPUP
			case 'pop760':

				var sh = screen.height;
				var sw = screen.width;

				var wx = (sw / 2) - 380;
				var wy = (sh / 2) - 250;

				newPopup760 = window.open(target,'eagpopup','toolbar=no,menubar=yes,scrollbars=yes,resizable=yes,width=760,height=500,left='+wx+',top='+wy);
				newPopup760.focus();

			break;

			default:
				window.open(target,mode);

		} // END SWITCH

	} // END FUNCTION

/***********************************************/
/*** OPEN ADVANTAGE POPUP                    ***/
/***********************************************/

	function openAdvantage (isocode,langid) {

		var sh = screen.height;
		var sw = screen.width;

		var wx = (sw / 2) - 310;
		var wy = (sh / 2) - 250;

		newWindow = window.open('../advantage/advantage.php?isocode='+isocode+'&l='+langid,'advantage','scrollbars=yes,resizable=no,menubar=no,toolbar=no,width=620,height=500,left='+wx+',top='+wy);
		newWindow.focus();

	} // END FUNCTION

/***********************************************/
/*** OPEN ADVANTAGE POPUP                    ***/
/***********************************************/

	function openAdvantageGewinnspiel () {

		var sh = screen.height;
		var sw = screen.width;

		var wx = (sw / 2) - 310;
		var wy = (sh / 2) - 250;

		newWindow = window.open('../advantage.php?isocode=de&l=2&page=6','advantage','scrollbars=yes,resizable=no,menubar=no,toolbar=no,width=620,height=500,left='+wx+',top='+wy);
		newWindow.focus();

	} // END FUNCTION

/***********************************************/
/*** OPEN ADVANTAGE POPUP                    ***/
/***********************************************/

	function openAdvantageAuWin () {

		var sh = screen.height;
		var sw = screen.width;

		var wx = (sw / 2) - 310;
		var wy = (sh / 2) - 250;

		newWindow = window.open('../advantage/advantage.php?isocode=au&l=4&page=6','advantage','scrollbars=yes,resizable=no,menubar=no,toolbar=no,width=620,height=500,left='+wx+',top='+wy);
		newWindow.focus();

	} // END FUNCTION

/***********************************************/
/*** OPEN ADVANTAGE POPUP BY SELECTFIELD     ***/
/***********************************************/

	function openSelectAdvantage (sboxname) {

		var sbox = eval('document.countryform.'+sboxname);
		var actindex = sbox.selectedIndex;
		var actvalue = sbox.options[actindex].value;

		var sh = screen.height;
		var sw = screen.width;

		var wx = (sw / 2) - 310;
		var wy = (sh / 2) - 250;

		if (actvalue == '') {

			// NO COUNTRY SELECTED
			alert('Please select a country!');
			return (false);

		} else {

			// SPLIT VALUE
			var actvaluear = actvalue.split('|');

			// CHECK COUNTRY
			/*if (actvaluear[0] == 'at') {

				jump('http://www.schott-labtech.com/','_blank');

			} else*/
			if (actvaluear[0] == 'us') {

				jump('http://www.eppendorf.com/int/index.php?l=131&action=promotions&contentid=1&sitemap=3','_self');

			} else if (actvaluear[0] == 'ca') {

				jump('http://www.eppendorf.ca/int/index.php?l=211&action=promotions&contentid=1&sitemap=3','_self');

			} else /*if (actvaluear[0] == 'ar' || actvaluear[0] == 'bo' || actvaluear[0] == 'br' ||
						actvaluear[0] == 'cl' || actvaluear[0] == 'co' || actvaluear[0] == 'ec' ||
						actvaluear[0] == 'pe' || actvaluear[0] == 'uy' || actvaluear[0] == 've') {

				jump('http://www.eppendorf.com/int/index.php?l=91&action=promotions&contentid=2&sitemap=3.2','_self');

			} else*/ {

				jump('index.php?l='+actvaluear[1]+'&action=advantage&sitemap=3.2&isocode='+actvaluear[0],'_self');

				// newWindow = window.open('../advantage/advantage.php?isocode='+actvaluear[0]+'&l='+actvaluear[1],'advantage','scrollbars=yes,resizable=no,menubar=no,toolbar=no,width=620,height=500,left='+wx+',top='+wy);
				// newWindow.focus();

			} // END ELSE

			return (true);

		} // END ELSE

	} // END FUNCTION

/***********************************************/
/*** SHOW MESSAGEBOX                         ***/
/***********************************************/

	function openMsgBox (id) {

		var obj = document.getElementById(id);
		var newTop = getYScroll();

		if (obj) {

			obj.style.visibility = 'visible';
			obj.style.top = newTop+'px';

		} // END IF

		return undefined;

	} // END FUCNTION

/***********************************************/
/*** GET PAGE Y OFFSET                       ***/
/***********************************************/

	function getYScroll(){

		var yScroll;

		if (self.pageYOffset) {

			yScroll = self.pageYOffset;

		} else if (document.documentElement && document.documentElement.scrollTop) {

			yScroll = document.documentElement.scrollTop;

		} else if (document.body) {

			yScroll = document.body.scrollTop;

		} // ELSE IF

		return yScroll;

	} // END FUNCTION
