
<!----------------------------------------- AJAX ----------------------------------------->

var xmlHttp = getXMLRequestObject();

function getXMLRequestObject_old( )
{
    var xmlHttp = false; 
	// TRY TO CREATE A NEW xmlhttprequest INSTANCE        
    try {
        // MICROSOFT INTERNET EXPLORER
        if ( window.ActiveXObject ) { 
			for ( var i = 5; i; i-- ) {
                try {
                    // LOADING OF NEWER DLL FAILED > USE FALLBACK
                    if ( i == 2 ) {
                        xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" );    
                    }
                    // TRY USING LATEST DLL
                    else {
						xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" );
                    }
                    break;
                }
                catch( excNotLoadable ) {                        
                    xmlHttp = false;
                }
            }
        }
        // MOZILLA, OPERA, SAFARI
        else if ( window.XMLHttpRequest ) {
			xmlHttp = new XMLHttpRequest();
        }
    }
    // LOADING OF xmlhttp OBJECT FAILED
    catch ( excNotLoadable ) {
        xmlHttp = false;
    }
    return xmlHttp ;
}

function getXMLRequestObject( )
{
    var xmlHttp = false; 
	// TRY TO CREATE A NEW xmlhttprequest INSTANCE        
    try {
		if (window.XMLHttpRequest) {
			// If IE7, Mozilla, Safari, etc: Use native object
			var xmlHttp = new XMLHttpRequest()
		}
		else {
			if (window.ActiveXObject) {
				// ...otherwise, use the ActiveX control for IE5.x and IE6
				var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
			}
		}
    }
    // LOADING OF xmlhttp OBJECT FAILED
    catch ( excNotLoadable ) {
        xmlHttp = false;
    }
    return xmlHttp;
}
function setAjaxOutput(outputID, loadingStr, startStr, endStr) {
	// LOADING
	if (xmlHttp.readyState == 1) {
		if (loadingStr != '') document.getElementById(outputID).innerHTML = startStr+loadingStr+endStr;
	}
	// READY
	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			var response = xmlHttp.responseText;
			if (response != '') {
				document.getElementById(outputID).innerHTML = startStr+response+endStr;
			}
			else {
				document.getElementById(outputID).innerHTML = '';
			}
		}
	}
}
function getAjaxText(selObj, ajaxURL, outputID, loadingStr, startStr, endStr) {
	if (selObj != '') {
		var formValue = document.getElementById(selObj);
		callURL = ajaxURL+formValue.options[formValue.selectedIndex].value;
	}
	else callURL = ajaxURL;
	xmlHttp.open('get', callURL);
	xmlHttp.onreadystatechange = function() {setAjaxOutput(outputID, loadingStr, startStr, endStr); }
	xmlHttp.send(null);
	// getAjaxText('', favURL, outputID, loadingStr, startStr, endStr);
}
function getAjaxText2(ajaxURL, outputID, loadingStr, startStr, endStr) {
	callURL = ajaxURL;
	xmlHttp.open('get', callURL);
	xmlHttp.onreadystatechange = function() {setAjaxOutput(outputID, loadingStr, startStr, endStr); }
	xmlHttp.send(null);
}

<!----------------------------------------- WINDOW-FUNCTIONS ----------------------------------------->
var popwin = null;
// FUNCTION TO OPEN MESSAGE OR IMAGE-WINDOWS
function openWindow(theLink,theWidth,theHeight,theScroll,theStatus,theResize,is_image,theAutoClose,theTargetWindow) {
	theLink = theLink;
	theLink += "";
	// FULLSCREEN IF NO SIZE
	if (theWidth == 0)  theWidth = screen.availWidth;
	if (theHeight == 0) theHeight = screen.availHeight;
	// CALCULATE WINDOW-POSITION DEPENDING ON SCREENSIZE
	if (is_image == 1) theWidth = theWidth + 38;
	if (is_image == 1) theHeight = theHeight + 30;
	centerW = ((screen.availWidth - theWidth) - 10)   / 2;
	centerH = ((screen.availHeight - theHeight) - 50) / 2;
	if (centerH < 0) centerH = 0;
	if (theWidth > screen.availWidth) {
		theWidth = screen.availWidth-10;
		theHeight = screen.availHeight-50;
		centerW = 0;
		centerH = 0;
	}
	if (theHeight > screen.availHeight) {
		theHeight = screen.availHeight-50;
		centerH = 0;
	}
	// CREATE StrING FOR WINDOW-ATtrIBUTES
	str =  "left="         + centerW;
	str += ",top="         + centerH;
	str += ",height="      + theHeight;
	str += ",width="       + theWidth;
	str += ",scrollbars="  + theScroll;
	str += ",status="      + theStatus;
	str += ",resizable="   + theResize;
	str += ",dependent=1";
	// OPEN WINDOW
	if (theTargetWindow != "") popwin = window.open(theLink, theTargetWindow, str);
	else popwin = window.open(theLink, "popwin", str);
	if (theAutoClose < 1) popwin = null;
	self.name = "PopWin"; 
}
// FUNCTION TO AUTO-CLOSE OPENED WINDOWS THRU THE MAIN-WINDOW
function theWindowsBlur() {
	if (popwin && typeof(window.popwin) != "undefined") window.popwin.close();
}
// FUNCTION TO RESIZE A CENTERED WINDOW
function resizeWindow(theWidth, theHeight, theTop, theLeft, theCenter, theMaxWidth, theMaxHeight) {
	if (theMaxHeight == 1) theHeight = screen.availHeight;
	if (theMaxWidth == 1)  theWidth  = screen.availWidth;
	if (theCenter == 1) {
		theLeft = ((screen.availWidth - theWidth))   / 2;
		theTop  = ((screen.availHeight - theHeight)) / 2;
	}
	if (theWidth > screen.availWidth) {
		theWidth  = screen.availWidth;
		theLeft   = 0;
	}
	if (theHeight > screen.availHeight) {
		theHeight = screen.availHeight;
		theTop    = 0;
	}
	window.resizeTo(theWidth, theHeight);
	window.moveTo(theLeft, theTop);
}	
	
<!----------------------------------------- COOKIE-CHECK ----------------------------------------->
// FUNCTION TO CHECK IF THE USER ACCEPTS COOKIES
function getCookie(name) {
	var i=0;
	var suche = name+"=";
	while (i<document.cookie.length) {
		if (document.cookie.substring(i, i+suche.length)==suche) {
			var ende = document.cookie.indexOf(";", i+suche.length);
			ende = (ende>-1) ? ende : document.cookie.length;
			var cook = document.cookie.substring(i+suche.length, ende);
			return unescape(cook);
		}
		i++;
	}
	return "";
}
function checkCookie(error_message, error_location) {
	var f = document.form_1;
	if (!getCookie("Scabies_UID")) {
		location.href = error_location;
		alert(error_message);
	}
	else return true;
}

// COOKIE TESTS
function testGetCookie( check_name ) {
	// To use: testGetCookie('cookie_name'); 
	// replace cookie_name with real cookie name
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false;
	
	for ( i = 0; i < a_all_cookies.length; i++ ) {
		a_temp_cookie = a_all_cookies[i].split( '=' );
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		if ( cookie_name == check_name ) {
			b_cookie_found = true;
			if ( a_temp_cookie.length > 1 ) {
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found ) {
		return null;
	}
}
function testSetCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) expires = expires * 1000 * 60 * 60 * 24;
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + //expires.toGMTString()
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}
function testDeleteCookie( name, path, domain ) {
	if ( testGetCookie( name ) ) document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
function testCookies() {
	testSetCookie('check', '1', '', '/', '', '');
	if (testGetCookie('check')) {
		testDeleteCookie('check', '/', '');
		return true;
	}
	else return false;
}

<!----------------------------------------- FAVORITES-HANDLER ----------------------------------------->
// FUNCTION TO CHECK OR DELETE FAVORITES FOR CURRENT USER
function checkFavorite(formID, productID, showExternal) {
	var f = document.getElementById(formID);
	if (f.checked)  favURL = '?product_id='+productID+'&mode='+'favorites_add';
	if (!f.checked) favURL = '?product_id='+productID+'&mode='+'favorites_delete';		
	if (showExternal == 1) openWindow(favURL,"100","100","0","0","0","0","1");
	else return favURL;
}

// FUNCTION TO CHECK OR DELETE FAVORITES FOR CURRENT USER
function checkFavoriteAjax(favURL, favID, productID, outputID, loadingStr, startStr, endStr) {
	var f = document.getElementById(favID);
	if (f.checked)  favURL = favURL+'?product_id='+productID+'&mode='+'favorites_add';
	if (!f.checked) favURL = favURL+'?product_id='+productID+'&mode='+'favorites_delete';		
	getAjaxText('', favURL, outputID, loadingStr, startStr, endStr);
}	

<!----------------------------------------- PULLDOWN-HANDLER ----------------------------------------->
function jumpMenu(targ, selObj, restore) {
	if (targ != '') eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	else            eval("window.location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}
function callFunction(selObj, restore) {
	result = eval(selObj.options[selObj.selectedIndex].value);
	if (restore || result == false) selObj.selectedIndex=0;
}

<!----------------------------------------- TOOLTIP-FUNCTION ----------------------------------------->	
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;

offsetX = 10;
offsetY = 10;
var toolTipSTYLE="";

function initToolTips() {
	if (ns4 || ns6 || ie4) {
		if (ns4) toolTipSTYLE       = document.toolTipLayer;
		else if (ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
		else if (ie4) toolTipSTYLE = document.all.toolTipLayer.style;
		if (ns4) document.captureEvents(Event.MOUSEMOVE);
		else {
			toolTipSTYLE.visibility = "visible";
			toolTipSTYLE.display    = "none";
		}
		document.onmousemove = moveToMouseLoc;
	}
}
function toolTip(msg, fg, bg) {
	if (toolTip.arguments.length < 1) { // hide
		if (ns4) toolTipSTYLE.visibility = "hidden";
		else toolTipSTYLE.display = "none";
	}
	else { // show
		if (!fg) fg = "tooltip-text";
		if (!bg) bg = "tooltip-background";
		var content =
			'<table class="' + bg + '">' + 
			'<tr><td align="left">' + 
			'<font class="' + fg + '">' + msg + '</font>' + 
			'</td></tr></table>';
		if (ns4) {
			toolTipSTYLE.document.write(content);
			toolTipSTYLE.document.close();
			toolTipSTYLE.visibility = "visible";
		}
		if (ns6) {
			document.getElementById("toolTipLayer").innerHTML = content;
			toolTipSTYLE.display='block'
		}
		if (ie4) {
			document.all("toolTipLayer").innerHTML=content;
			toolTipSTYLE.display='block'
		}
	}
}
function moveToMouseLoc(e) {
	if (ns4 || ns6) {
		x = e.pageX;
		y = e.pageY;
	}
	else {
		x = event.x + document.body.scrollLeft;
		y = event.y + document.body.scrollTop;
	}
	toolTipSTYLE.left = x + offsetX + 'px';
	toolTipSTYLE.top  = y + offsetY + 'px';
	return true;
}

<!----------------------------------------- DISABLE RIGHT-CLICK ----------------------------------------->
function disableRightClick(e)
{
	// initialize 
	if (!document.rightClickDisabled) {
		if (document.layers) {
			document.captureEvents(Event.MOUSEDOWN);
			document.onmousedown = disableRightClick;
		}
		else document.oncontextmenu = disableRightClick;
		return document.rightClickDisabled = true;
	}
	if (document.layers || (document.getElementById && !document.all)) {
		if (e.which==2 || e.which==3) {
			return false;
		}
	}
	else {
		return false;
	}
}
disableRightClick();

<!----------------------------------------- FORM-FUNCTIONS ----------------------------------------->
function checkEmail(error_message) {
	var str=document.forms[0].user_email.value;
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	// CHECK
	if (filter.test(str)) {
		return true;
	}
	else {
		alert(error_message);
		return false;
	}
}
function checkUserData(error_message_1, error_message_2, error_message_3) {
	if (document.forms[0].user_name.value == "") {
		alert(error_message_1);
		return false;
	} 
	if (document.forms[0].user_email.value == "" || document.forms[0].user_email.value != "") {
		var str=document.forms[0].user_email.value;
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
		if (filter.test(str) == false) { 
			alert(error_message_2); 
			return false; 
		}
	}
	if (document.forms[0].user_message.value == "") {
		alert(error_message_3);
		return false;
	}
}
<!----------------------------------------- ENABLE FULLSCREEN-VIDEO ----------------------------------------->
function fullSize() {
		player.fullScreen = "true";
		player.DisplaySize = 3;
}
<!----------------------------------------- BUY PPV-PRODUCT ----------------------------------------->
function pay_ppv(the_form, payment_link, product_id) {
	var f         = document.forms[the_form];
	// OPTION LIST
	var rate      = f.elements[product_id].selectedIndex + 1;
	// RADIO GROUP
	if (! rate > 0) {
		if      (f.elements[product_id]    && f.elements[product_id].checked)    rate = f.elements[product_id].value;
		else if (f.elements[product_id][0] && f.elements[product_id][0].checked) rate = f.elements[product_id][0].value;
		else if (f.elements[product_id][1] && f.elements[product_id][1].checked) rate = f.elements[product_id][1].value;
		else if (f.elements[product_id][2] && f.elements[product_id][2].checked) rate = f.elements[product_id][2].value;
		else if (f.elements[product_id][3] && f.elements[product_id][3].checked) rate = f.elements[product_id][3].value;
		else rate = 1;
	}
	var loc       = payment_link + product_id + '&rate=' + rate;		
	if (f.elements[product_id + '_paysystem']) {
		var paysystem = f.elements[product_id + '_paysystem'].selectedIndex + 1;
		loc           = loc + '&paysystem=' + paysystem;	
	}
	location = loc;
}
function pay_ppv_ext(the_form, payment_link, product_id) {
	var f     = document.forms[the_form];
	// ELEMENT LIST
	var rate  = f.elements[product_id].selectedIndex + 1;
	// RADIO GROUP
	if (! rate > 0) {
		if (f.elements[product_id][0].checked)      rate = 1;
		else if (f.elements[product_id][1].checked) rate = 2;
		else if (f.elements[product_id][2].checked) rate = 3;
		else rate = 1; 
	}
	var theLink   = payment_link + product_id +'&rate=' + rate;	
	if (f.elements[product_id + '_paysystem']) {
		var paysystem = f.elements[product_id + '_paysystem'].selectedIndex + 1;
		var theLink   = theLink + '&paysystem=' + paysystem;	
	}		
	openWindow(theLink,950,10000,1,1,1,0,0,'external');		
}