function gup( name ) {  
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+name+"=([^&#]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec( window.location.href );
    if( results == null )
        return "";
    else
        return decodeURIComponent(results[1]);
}

function rO(obj, wo) {
	var objRef = (obj.childNodes.length == 0) ? obj : (obj.firstChild.src != null) ? obj.firstChild : obj.lastChild;
	if(objRef != null) {
		if(objRef.tagName != null) {
			if(objRef.tagName.toLowerCase() == 'img') {
				objRef.src = (wo == 1) ? objRef.src.split('_lo.').join('_hi.') : objRef.src.split('_hi.').join('_lo.');
			} else if (objRef.tagName.toLowerCase() == 'input' && objRef.type.toLowerCase() == 'image') {
				objRef.src = (wo == 1) ? objRef.src.split('_lo.').join('_hi.') : objRef.src.split('_hi.').join('_lo.');
			} else if (objRef.tagName.toLowerCase() == 'div' || objRef.tagName.toLowerCase() == 'span') {
				if(objRef.style.filter) {
					objRef.style.filter = (wo == 1) ? objRef.style.filter.split('_lo.').join('_hi.') : objRef.style.filter.split('_hi.').join('_lo.');
				}
				objRef = (objRef.childNodes.length == 0) ? obj : (objRef.firstChild.src != null) ? objRef.firstChild : objRef.lastChild;
				if(objRef != null) {
					if(objRef.tagName != null) {
						if(objRef.tagName.toLowerCase() == 'img') {
							objRef.src = (wo == 1) ? objRef.src.split('_lo.').join('_hi.') : objRef.src.split('_hi.').join('_lo.');
						}
					}
				}
			} 
		}
	}
}

function ActivateForm()
{
	document.forms['aspnetForm'].onsubmit = function (event) {return WebForm_OnSubmit();};
}


function DeActivateForm()
{
	document.forms['aspnetForm'].onsubmit = function() {return false;};
}


function By1eEuropeCallNewsDetail(caller, newsId)
{
    By1eEuropeCallTarget(caller,'news');
    caller.href = caller.href + '&NewsID='+newsId;
}

function By1eEuropeCallShoppingListPrint(caller, shTitel)
{
    By1eEuropeCallTarget(caller,'shoppinglistprint');
    caller.href = caller.href + '&shTitel=' + shTitel;
    //Integration Google Tracking Code [Department: Online Redaktion |Autor: André Obrist | Date: 17.06.2009]
    //Start
    pageTracker._trackEvent('Button', 'onClick', 'Shopping List Print');
    //End
    
}

function By1eEuropeCallShoppingListLine(caller, webGuid, list, teaserId)
{
    var contentArea= "";
	if (document.getElementById('contentAreaLayoutPage')!=null)
		contentArea= document.getElementById('contentAreaLayoutPage').className;
		
    By1eEuropeCallTarget(caller,'shoppinglistline');
    caller.href = caller.href + '&webGuid='+webGuid + '&list='+list + '&teaserId='+teaserId + '&contentArea='+contentArea;
}

function By1eEuropeCallStoreFinder(caller, input)
{
    By1eEuropeCallTarget(caller,'storefinder');
    if (input != 'Bitte Ort oder PLZ eingeben' && input != 'Indiquer un lieu et un code postal' && input != 'Si prega di inserire luogo e CAP' )
    	caller.href = caller.href + '&eingabe='+input;
}

function By1eEuropeCallPLZSearch(caller, input)
{
    By1eEuropeCallTarget(caller,'regionredirect');
    caller.href = caller.href + '&eingabe='+input;
}

function By1eEuropeCallShoppingList(caller, input)
{
    By1eEuropeCallTarget(caller,'ShoppingList');
    if (input == null && parent != null)
    {
      input = parent.location.href;
    }
    caller.href = caller.href + '&referrer=' + input;
    //Integration Google Tracking Code [Department: Online Redaktion |Autor: André Obrist | Date: 11.12.2008]
    //Start
    pageTracker._trackEvent('Button', 'onClick', 'Einkaufsliste Weiter');
    //End
    
}

function By1eEuropeCallTarget(caller, targettype)
{
    var lang = "";
	if (document.getElementById('webLangInfo')!=null)
		lang = document.getElementById('webLangInfo').content;
		
	var path = "/";
	if (document.getElementById('webRelativeUrl')!=null)
	    path = document.getElementById('webRelativeUrl').content;
	if (path != "/")
	    path = path + "/";
	    
	caller.href = path+'_layouts/By1eEuropeMPR/Tools/Redirect.aspx?targettype='+targettype+'&lang='+lang;
}

function By1eEuropeClickItemOnEnter(toclick, ev)
{
	var ret = true;
	
	if (!ev)
        ev = window.event;
    
	if (ev.which && ev.which == 13 || ev.keyCode && ev.keyCode == 13) {
        if (toclick.click) {
          toclick.click();
        } else {
          MozillaLinkClick(toclick);
        }
        ret = false;
	}
	
	return ret;
}


function MozillaLinkClick(plnkNode)
{
    // Emulate click on Mozilla
    var bolFollowLink = true;
    var strTarget = null;

    // Run the link onClick event.
    if (plnkNode.onclick) {
        if (plnkNode.onclick() == false) {
            bolFollowLink = false;
        }
    }

    // Get the link target.
    if (plnkNode.target) {
        strTarget = plnkNode.target;
    }
    if (bolFollowLink) {
        if (strTarget == null) {
            window.location.href = plnkNode.href;
        } else {
            // Open using the link target.
            window.open(plnkNode.href, strTarget);
        }
    }
}

function By1eEuropeCheckShoppingListState()
{
	
	if (document.getElementById('shoppingListActive') != null)
	{
		var slActive = document.getElementById('shoppingListActive').content;
		if (slActive == 'True')
		{
			var container = document.getElementById('ShoppingListIFrameContainer');
			if (container != null)
			{
				By1eEuropeActivateShoppingListInfo(container);

				var lang = "de";
				if (document.getElementById('webLangInfo')!=null)
					lang = document.getElementById('webLangInfo').content;
					
				var contentArea= "";
				if (document.getElementById('contentAreaLayoutPage')!=null)
					contentArea= document.getElementById('contentAreaLayoutPage').className;

				frames['ShoppingListInfo'].location.href = '/_layouts/By1eEuropeMPR/Tools/Redirect.aspx?targettype=shoppinglistline&lang='+lang+'&contentArea='+contentArea;
			}
		}
	}	
}

function By1eEuropeActivateShoppingListInfo(slContainer)
{
	if (slContainer != null)
	{
		slContainer.style.display = 'block';
	}
}

function OeffneFenster(url, width, height) { 
    help_string="toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" + width + ",height=" + height;

    if (navigator.userAgent.indexOf("MSIE") == -1) 
    { 
        if (!(window.remote_window && window.remote_window.document)) 
        { 
            remote_window = window.open(url, "remote", help_string); 
        } 
        else 
        { 
            window.remote_window.close(); 
            remote_window = window.open(url, "remote", help_string); 
        } 
    } 
    else 
    { 
        if (!(window.remote_window)) { 
             remote_window = window.open(url, "remote", help_string); 
        } 
        else 
        { 
            window.remote_window.close(); 
            remote_window = window.open(url, "remote", help_string); 
        } 
    } 

    if (navigator.userAgent.indexOf("MSIE 3") == -1) 
    { 
        window.remote_window.focus(); 
    } 
} 

function OeffneFensterScroll(url, width, height) { 
    help_string="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=" + width + ",height=" + height;

    if (navigator.userAgent.indexOf("MSIE") == -1) 
    { 
        if (!(window.remote_window && window.remote_window.document)) 
        { 
            remote_window = window.open(url, "remote", help_string); 
        } 
        else 
        { 
            window.remote_window.close(); 
            remote_window = window.open(url, "remote", help_string); 
        } 
    } 
    else 
    { 
        if (!(window.remote_window)) { 
             remote_window = window.open(url, "remote", help_string); 
        } 
        else 
        { 
            window.remote_window.close(); 
            remote_window = window.open(url, "remote", help_string); 
        } 
    } 

    if (navigator.userAgent.indexOf("MSIE 3") == -1) 
    { 
        window.remote_window.focus(); 
    } 
} 



