var b = 0;

function openwd(b, c) 
{
    var jetzt = new Date();
    F1 = window.open("http://www.wertpunkte.de/CountClick.php?key="+jetzt.getTime()+"&wert="+b+"&buid="+c,"Wertpunkte","scrollbars=yes,width=510,height=600,left=0,top=0");
    F1.focus();
    return false;
}

function PopUp(url)
{
    var Fensteroptionen = "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0";
    var Breite = 500;
    var Hoehe = 200;
    window.open(url, 'wertpunkte.de', Fensteroptionen + ',width=' + Breite + ',height=' + Hoehe+',left=100,top=200');
}

function createRequestObject()
{
    var ro;
    var browser = navigator.appName;

    if(browser == "Microsoft Internet Explorer")
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    else
        ro = new XMLHttpRequest();

    return ro;
}

function getShoppingCom(element, title)
{
    var http = createRequestObject();
    http.open('get', '/proxy.php?search=' + encode_utf8(title));
    
    http.onreadystatechange = function ()
    {        
        if(http.readyState == 4)
            if(http.status == 200)
                element.innerHTML += http.responseText + '<br />';
    }
    
    http.send(null);
}

function focusFormular(feld, wert)
{
	if(feld.value == wert)
	{
		feld.value = '';
	}
	else
	{
		feld.select();
	}
}

function blurFormular(feld, wert)
{
	if(feld.value == '')
	{
		feld.value = wert;
	}
}

function changeItem(item)
{
	var value = item.options[item.selectedIndex].value.split("|");
	
	if(value.length != 2)
	{
		window.location.href=item.options[item.selectedIndex].value;
	}
	else
	{
		window.open(value[1], 'wertpunkte', 'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=1020,height=800');
	}    
}



function encode_utf8(rohtext) {
     // dient der Normalisierung des Zeilenumbruchs
     rohtext = rohtext.replace(/\r\n/g,"\n");
     var utftext = "";
     for(var n=0; n<rohtext.length; n++)
         {
         // ermitteln des Unicodes des  aktuellen Zeichens
         var c=rohtext.charCodeAt(n);
         // alle Zeichen von 0-127 => 1byte
         if (c<128)
             utftext += String.fromCharCode(c);
         // alle Zeichen von 127 bis 2047 => 2byte
         else if((c>127) && (c<2048)) {
             utftext += String.fromCharCode((c>>6)|192);
             utftext += String.fromCharCode((c&63)|128);}
         // alle Zeichen von 2048 bis 66536 => 3byte
         else {
             utftext += String.fromCharCode((c>>12)|224);
             utftext += String.fromCharCode(((c>>6)&63)|128);
             utftext += String.fromCharCode((c&63)|128);}
         }
     return utftext;
 }