var isIE = (navigator.userAgent.indexOf("MSIE") != -1) ? true : false;
var paymenttest = new Array();
var playerPopupWindow = null;
var pConnectReady = true;
var pPreload = false;

function openSPlayer(focusrow,doplay) {
	if (!isplay)
	 	return false;
	
	var addparam = '';
	if (doplay)
		addparam=addparam+'&doplay=true';

	if (pPreload) {
		pPreload = false;
		addparam=addparam+'&preload=true';
	}

	if (!playerPopupWindow || playerPopupWindow.closed || !playerPopupWindow.updateSPlayer) {
		playerPopupWindow = window.open(url+"splayer"+addparam, "splayerpopup","menubar=0,resizable=0,width=324,height=409");
		self.name = 'mainwin';
		if (!playerPopupWindow) {  // if popup blocked
			moeAlert('Pop up-vindue til streaming af playliste kunne ikke åbnes. <a href="#" onclick="openSPlayer('+focusrow+','+doplay+');return false">Klik her for at åbne den igen.</a>');
		}
		
		if (playerPopupWindow) {
			//if (playerPopupWindow.focus) window.focus();
		}
	}
	else playerPopupWindow.updateSPlayer(focusrow,doplay);
}

function openSPlayerFocus(focusrow,doplay) {
			openSPlayer(focusrow,doplay);
			if (playerPopupWindow) {
				playerPopupWindow.focus();
			}
}

function openSPlayerFocusNoReload(focusrow,doplay) {
			if (playerPopupWindow && !playerPopupWindow.closed && playerPopupWindow.updateSPlayer) {
				playerPopupWindow.focus();
				
				if (playerPopupWindow.spCurrentState!="PLAYING")
				   playerPopupWindow.spPlayerButton();
			}
			else
				openSPlayer(focusrow,doplay);
}

function updatecart(lmid, flag) {
	var trigger = gettrigger();
//	loaddata(url + 'updatecart' + '&lmid=' + lmid + '&flag=' + flag, 'baskettotal');	
        $.ajax({
            type: "POST",
            dataType: "html",
            url: url + 'updatecart' + '&lmid=' + lmid + '&flag=' + flag,
            data:   "",
            success: function(msg){
                $("#baskettotal").html(msg);
            }
        });

	//$("#basket li").addClass("highlight");		

//	if (flag==1)
   	showindicator(trigger, 'Musikken lægges<br />i kurven');
}

////////////////////////////////////////////////
// STREAMING
function updatepm(lmid,doclear,doplay) {
	var trigger = gettrigger();

	pid = "&__="+encodeURIComponent((new Date()).getTime());

   	showindicatorpl(trigger, 'Musikken lægges<br />i kurven');
	
	if (doclear) 
		pid='&doclear=true'+pid;

	// open "empty" window now to prevent popup blocker
	if (!playerPopupWindow || playerPopupWindow.closed || !playerPopupWindow.updateSPlayer) { 
		pPreload=true;
		openSPlayer(-1,false);
		pPreload=false;
	}

	$.get(url + '_playmaker_functions' + '&action=pmcurupdate&lmid=' + lmid + pid, function(data) {
		$("#pm_sum").html($(data).html());
		
		if (doclear)
			openSPlayer(0,doplay);
		else
			openSPlayer(-1,doplay);		
			
		pnum = $(data).text().replace(/i alt/i, "");
		pnum = pnum.substr(0,pnum.indexOf("nu")-1);
		
		if (parseInt(pnum)>=50 && !doclear && playerPopupWindow) 
		   moeAlert("Det er ikke muligt at tilføje mere end 50 musiknumre til din playliste. Fjern et musiknummer på listen ved at klikke på 'slet' knappen ud for det enkelte nummer.");
	});
}

function showindicatorpl(trigger, text) {
	var thebody = document.getElementsByTagName("body")[0];
	temp = new Date(); temp = temp.getTime();
	
	notice = document.createElement("div");
	notice.setAttribute("id", "addingtoplaylist");
	
	if (isIE)
	{
		x = findPosX(trigger);
		y = findPosY(trigger);
		notice.style.setAttribute('cssText', 'left:' + (x-115) + 'px; top:' + (y+15) + 'px;', 0);
	}
	else
	{
		notice.style.left = gposx+"px";
		notice.style.top = gposy+"px";
	}
	
	notice.innerHTML = '';
	
	$("body").append(notice);
	
	// delay, fade out and remove
	setTimeout(function() {
		$(notice).hide();
		$(notice).remove();
		$("body").unbind('mousemove');
	}, 1500);	
}

var blackDiv = document.createElement('div');
var alertDiv = document.createElement('div');

function isBadDhtmlIE() {
	isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
	return isIE6;
}

function closePop() {
	document.getElementById('blackDiv').style.display='none';
	document.getElementById('alertDiv').style.display='none';
	document.body.onscroll=null;
	//window.removeEventListener('scroll',updatePopPos,false);
    if (document.getElementById("sqtypeid") && isBadDhtmlIE())
		document.getElementById("sqtypeid").style.display = "inline";
}

function updatePopPos() {
	var theHeight;
	if (self.innerHeight) // all except Explorer
		theHeight = self.innerHeight;
	else if (document.documentElement && document.documentElement.clientHeight) // Explorer 6 Strict Mode
		theHeight = document.documentElement.clientHeight;
	else if (document.body) // other Explorers
		theHeight = document.body.clientHeight;

	var theTop;
	if (self.pageYOffset) // all except Explorer
		theTop = self.pageYOffset;
	else if (document.documentElement && document.documentElement.scrollTop) // Explorer 6 Strict
		theTop = document.documentElement.scrollTop;
	else if (document.body) // all other Explorers
		theTop = document.body.scrollTop;

	theHeight = parseInt(theHeight/3);
	theTopPosition = (theTop + theHeight);
	
	alertDiv.style.top = theTopPosition;
}

function moeAlertEx(text,showclosebutton) {

    if (document.getElementById("sqtypeid") && isBadDhtmlIE())
		document.getElementById("sqtypeid").style.display = "none";

	var theHeight;
	if (self.innerHeight) {
		// all except Explorer
		theHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		// Explorer 6 Strict Mode
		theHeight = document.documentElement.clientHeight;
	} else if (document.body) {
		// other Explorers
		theHeight = document.body.clientHeight;
	}

	var theTop;
	if (self.pageYOffset) // all except Explorer
		theTop = self.pageYOffset
	else if (document.documentElement && document.documentElement.scrollTop) // Explorer 6 Strict
		theTop = document.documentElement.scrollTop
	else if (document.body) // all other Explorers
		theTop = document.body.scrollTop;

	theHeight = parseInt(theHeight/3);
	theTopPosition = (theTop + theHeight);

	if(document.attachEvent) {
		document.body.onscroll = updatePopPos;
		document.body.onresize = updatePopPos;
	} else {
		window.addEventListener('resize',updatePopPos,false);
		window.addEventListener('scroll',updatePopPos,false);
	}
	
	var y;
	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight;
	if (test1 > test2) {
		// all but Explorer Mac
		y = document.body.scrollHeight;
	} else {
		// Explorer Mac; //would also work in Explorer 6 Strict, Mozilla and Safari
		y = document.body.offsetHeight;
	}

	blackDiv.setAttribute('id','blackDiv');
	blackDiv.style.display='block';
	blackDiv.style.backgroundColor='#000000';
	blackDiv.style.position='absolute';
	blackDiv.style.zIndex='99999';
	blackDiv.style.top=0;
	blackDiv.style.left=0;
	blackDiv.style.filter='alpha(opacity=50)';
	blackDiv.style.MozOpacity='0.50';
	blackDiv.style.width='100%';
	blackDiv.style.height=y + 'px';
	document.body.appendChild(blackDiv);

	alertDiv.setAttribute('id','alertDiv');
	alertDiv.style.display='block';
	alertDiv.style.borderWidth='1px';
	alertDiv.style.borderStyle='solid';
	alertDiv.style.borderColor='#000000';
	alertDiv.style.backgroundColor='#FFFFFF';
	alertDiv.style.position='absolute';
	alertDiv.style.zIndex='99999';
	alertDiv.style.filter='alpha(opacity=95)';
	alertDiv.style.MozOpacity='0.95';
	alertDiv.style.fontFamily='verdana';	
	alertDiv.style.fontSize='12px';
	alertDiv.style.padding='10px';
	alertDiv.style.textAlign='left';
	alertDiv.style.width='450px';
	alertDiv.style.top=theTopPosition + 'px';
	alertDiv.style.left='33%';
	document.body.appendChild(alertDiv);

	var printLuk;
	printLuk = '<br><br>';
	printLuk += '<input class="t-button" type="button" onclick="closePop();" value="Luk">';

	if (!showclosebutton)
	   printLuk = "";

	document.getElementById('alertDiv').innerHTML = text + printLuk;
}

function moeAlert(text) {
	moeAlertEx(text,true);
}

function moeAlertCust(text) {
	moeAlertEx(text,false);
}

///////////////////////////////////////////

function updatecart_ext(lmid, wmencpid, slid, uotid, flag) {
	var trigger = gettrigger();
	if (flag == 0) {
		var params = lmid + ':' + slid + ':' + wmencpid + ':' + wmencpid + ':' + uotid + ':' + uotid + ':' + flag;
		location.href = url + 'viewcart&UpdateCart=' + params;
	} else {
		var params = lmid + ':0:' + wmencpid + ':' + wmencpid + ':' + uotid + ':' + uotid + ':' + flag;
		//loaddata(url + 'updatecart_ext' + '&UpdateCart=' + params, 'baskettotal');
	    $.ajax({
	        type: "POST",
	        dataType: "html",
	        url: url + 'updatecart_ext' + '&UpdateCart=' + params,
	        data:   "",
	        success: function(result) {
			    $("table#baskettotal").html(result);
			    if (flag==1) {
			        showindicator(trigger, 'Musikken lægges<br />i kurven');
			    }
	        }
	    });
	}
	
}

function valfilename(x) {
  x = x.replace(/\#/g, "");      // delete #	
  x = x.replace(/\*/g, "");      // delete *
  x = x.replace(/\[/g, "");      // delete [
  x = x.replace(/\]/g, "");      // delete ]
  x = x.replace(/\</g, "");      // delete <
  x = x.replace(/\>/g, "");      // delete >
  x = x.replace(/\=/g, "");      // delete =
  x = x.replace(/\%/g, "");      // delete %  
  x = x.replace(/\+/g, "");      // delete +
  x = x.replace(/\&/g, "");      // delete &  
  x = x.replace(/\?/g, "");      // delete ?	  
  x = x.replace(/\'/g, "");      // delete '
  x = x.replace(/\"/g, "");      // delete "
  x = x.replace(/\\/g, "");      // delete \
  x = x.replace(/\//g, "");      // delete /
  x = x.replace(/\,/g, "");      // delete ,
  x = x.replace(/\./g, "");      // delete .
  x = x.replace(/\:/g, "");      // delete :
  x = x.replace(/\;/g, "");      // delete ;
  x = x.replace(/\|/g, "");      // delete | 
  x = x.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); // trim
  x = x.replace(/ /g, "_");
  x = x.replace(/__/g, "_");
  x = encodeURI(x);
  return x;
}

function playdl(flag, ulmid, upaygrpid, upaysrcid, dlname) {
    if (dlname=='' || dlname=='Play__') {
      dlname = 'YouSeePlay_download.zip';
    } else {
      dlname = valfilename(dlname)+'.zip';
    }

	var trigger = gettrigger();	
	temp = new Date(); temp = temp.getTime();
	if (flag == 0) {
		var params = '&ulmid=' + ulmid + '&upaygrpid=' + upaygrpid + '&upaysrcid=' + upaysrcid;
		showdownload(trigger, '', temp);
		loaddata(url + 'umapdownload' + params, temp, 'umapfile');
	}
	else
	if (flag == 1) {
		var params = '&ulmid=' + ulmid + '&upaygrpid=' + upaygrpid + '&upaysrcid=' + upaysrcid + '&uretdllistlink=true&dlname='+dlname;
		showdownload(trigger, '', temp);
		loaddata(url + 'umapdownload' + params, temp, 'umapfile');
	}
	else
	if (flag == 2) {
		var params = '&uaddlist=' + ulmid + '&uretdllistlink=true&dlname='+dlname;
		showdownload(trigger, '', temp);
//		window.location.href = url + 'umapdownload' + params;
		loaddata(url + 'umapdownload' + params, temp, 'umapfile');
	}
}


function showdownload(trigger, text, temp) {

	t = $('<div class="dl_div" id='+temp+'></div>');

	if (isIE)
	{
		mx = findPosX(trigger);
		my = findPosY(trigger);
	}
	else
	{
		my = gposy;
		mx = gposx;
	}

    t.css('left', mx+'px');
    t.css('top', my+'px');	

	if (text=='') text = 'Musikken forberedes til dig' ;
    cb = "document.getElementById('" + temp + "').style.display = 'none';"
	cimg = '<img src="' + rootdir + 'img/dllogo.jpg" /><br />';	
	
    t.html(cimg+text +'<br /><br /><span class="jcurs" onclick="'+cb+'"><u>Annuller</u></span>');
	t.prependTo("body"); 
}


function fixdlfilename(x) {
  x = x.replace(/\*/g, "")      // delete *
  x = x.replace(/\[/g, "")      // delete [
  x = x.replace(/\]/g, "")      // delete ]
  x = x.replace(/\</g, "")      // delete <
  x = x.replace(/\>/g, "")      // delete >
  x = x.replace(/\=/g, "")      // delete =
  x = x.replace(/\+/g, "")      // delete +
  x = x.replace(/\&/g, "")      // delete &  
  x = x.replace(/\'/g, "")      // delete '
  x = x.replace(/\"/g, "")      // delete "
  x = x.replace(/\\/g, "")      // delete \
  x = x.replace(/\//g, "")      // delete /
  x = x.replace(/\,/g, "")      // delete ,
  x = x.replace(/\:/g, "")      // delete :
  x = x.replace(/\;/g, "")      // delete ;
  x = x.replace(/\|/g, "")      // delete | 
  x = x.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); // trim
  x = x.replace(/%/g, "")
  x = x.replace(/ /g, "_")
  x = x.replace(/__/g, "_")
  return x;
}

function showdownloadfinal(temp,dllink) {
	// We need to encode the filename part of the URL (the string after the last "/")!
	// see also ticket in OTRS: "Zip can can not be opened [247MS-Ticket#2009010610000551]" ...
	var dllinkchunks = dllink.split("/");
    dllinkchunks[dllinkchunks.length-1] = fixdlfilename(dllinkchunks[dllinkchunks.length-1]);
    var dllinkenc = dllinkchunks.join("/");
    // done. now output the tiny box with the fixed link.
	cb = "document.getElementById('" + temp + "').style.display = 'none';";
	cimg = '<img src="' + rootdir + 'img/dllogo.jpg" /><br />';	
	dl = '-[ <a href="'+dllinkenc+'" onclick="'+cb+'" class="playdownloadmusik"><b>Hent musikken</b></a> ]-<br /><br />';
	document.getElementById(temp).innerHTML = cimg+'Download klar..<br /><br />'+dl+'<span class="jcurs" onclick="'+cb+'"><u>Annuller</u></span>';
}

function showindicator(trigger, text) {
	var thebody = document.getElementsByTagName("body")[0];
	temp = new Date(); temp = temp.getTime();
	
	notice = document.createElement("div");
	notice.setAttribute("id", "addingtobasket");
	
	if (isIE)
	{
		x = findPosX(trigger);
		y = findPosY(trigger);
		notice.style.setAttribute('cssText', 'left:' + (x-115) + 'px; top:' + (y+15) + 'px; background-image: url('+rootdir+'img/icon-addingtobasket.gif);', 0);
	}
	else
	{
		notice.style.left = gposx+"px";
		notice.style.top = gposy+"px";
	}
	
	notice.innerHTML = '<p>' + textStrings.addingToBasket + '</p>';
	
	$("body").append(notice);
	
	// delay, fade out and remove
        $(notice).animate({opacity: 'hide'}, 2500, "easein", function() { 
            $(notice).remove();
            $("body").unbind('mousemove');
        });
/*
	setTimeout(function() {
		$(notice).animate({opacity: 'hide'}, 2500, "easein", function() { 
			$(notice).remove();
			$("body").unbind('mousemove');
		});
	}, 2500);
	*/	
}


function findPosX(obj) {var curleft = 0;if (obj.offsetParent) {while (obj.offsetParent) {curleft += obj.offsetLeft;obj = obj.offsetParent;}} else if (obj.x)curleft += obj.x;return curleft;}
function findPosY(obj) {var curtop = 0;if (obj.offsetParent) {while (obj.offsetParent) {curtop += obj.offsetTop;obj = obj.offsetParent;}} else if (obj.y) curtop += obj.y;return curtop;}

function play(type, param) {

	switch (type) {

		case 'onpage':
			var trigger = gettrigger();
			alert(player);
			break;

		case 'track':
/*			player.width = 385;
			player.height = 400;
			if (!param[1])
				player.popit('&trackid=' + param);
			else
				player.popit('&trackid=' + param[0] + '&wmencpid=' + param[1]);*/

			if (!param[1])
				PlayerControls.play('&trackid=' + param);
			else
				PlayerControls.play('&trackid=' + param[0] + '&wmencpid=' + param[1]);

			break;
		case 'video':
			player.width = 745;
			player.height = 400;
			player.popit('&trackid=' + param[0] + '&wmencpid=' + param[1] +'&wmfile=' + param[0] );
			break;
		case 'tt':
			PlayerControls.play('&tone_id=' + param);
			break;
	}
}

function playVideo(lmid, videourl) {
	play('video', videourl);
}

function play_ringtone(lmid) {
	player.width = 380;
	player.height = 380;
	player.popit('_ringtone&tone_id=' + lmid);
}

function pop_player() {
	this.width;
	this.height; // same all the time??
	this.playerwindow = window.player;
	this.popit = function(params) {
		//playerwindow = window.open(surl.replace("https:", "http:") + 'player' + params, 'player', 'width='+this.width+',height='+this.height+',status=no,scrollbars=no,resizable=no,toolbar=no');
		playerwindow = window.open(url + 'player' + params, 'player', 'width='+this.width+',height='+this.height+',status=no,scrollbars=no,resizable=no,toolbar=no');
		playerwindow.focus();
	}
}

function popup(file, width, height){
	var windowname=""
	if(arguments.length==3)
		windowname=arguments[3]
	window.open(file,windowname,"width="+width+",height="+height+",left=150,top=100,resizable=1,scrollbars=1")
}

function gettrigger() {
	var targ;
	if (navigator.userAgent.indexOf("Firefox")==-1) {
		if (!e) var e = window.event;
		if (e.target) targ = e.target;
		else if (e.srcElement) targ = e.srcElement;
		if (targ.nodeType == 3) // defeat Safari bug
			targ = targ.parentNode;
	}
	return targ;
}

function putdata(page, param, objname) {
	var indicator = '<img src="'+rootdir+'/img/indicator.gif">';
	var target = document.getElementById(objname);

	if (target.innerHTML=='' || target.innerHTML==indicator) {
		target.innerHTML = indicator;
		loaddata(url + '' + page + '&' + param, objname);
	}
	target.style.display = (target.style.display == 'none') ? 'block' : 'none';
}

function pop_rights(page, param) {
	window.open(url + '' + page + '&' + param, 'rights', 'width=550,height=550,resizable=1,scrollbars=1toolbar=0');
}

function pop_format(article_id) {
	window.open(url + 'article_small&article_id=' + article_id, 'articles', 'width=450,height=350,resizable=1,scrollbars=1toolbar=0');
}

function getpage(page) {
	location.href = url + '' + page;
}

function pop_box(obj, width, align, targetdisplay) {

	var target = document.getElementById(obj + '_target');
	var button = document.getElementById(obj);

	pop_x = findPosX(button);
	pop_y = findPosY(button);
    
	if (obj.indexOf("genre") == -1) {
		if (align=='left')
		target.style.left = (isIE) ? width +108 : pop_x + 3;
	}
	else { 
		if (align=='left')
		target.style.left = (isIE) ? width +138 : pop_x + 3;
	}
	
	if (align=='right')
	target.style.left = (isIE) ? pop_x - width - 3 + button.offsetWidth : pop_x - width - 5 + button.offsetWidth;
	
	target.style.top = (isIE) ? pop_y + 21 : pop_y + 22;
	if (targetdisplay=='dynamic')
		target.style.display = (target.style.display=='block') ? 'none' : 'block';
	else
		target.style.display = targetdisplay;
}

function shop_link(flag) {
	
	var obj = flag.split('|');
	var method = obj[0];
	var direction = obj[1];

	if (method=='ajax') {
		return true;
	} else {
		if(direction.indexOf('www.telmore.dk') != -1) {
			top.location = direction;
		}
		else {
		window.location = direction;
		}
	}
}
function ttsend(obj) {
var mobile_phone_no = '';
if (readCookie('mobile_phone_no'))
				mobile_phone_no = readCookie('mobile_phone_no');
var thebody = document.getElementsByTagName("body")[0];
var tttd = document.getElementById(obj);
var text = 	'<form action="" method="post" name="formttsend" onsubmit="JavaScript:return false;">' + 
			'<p>Indtast mobilnummer og <br />f&aring; tilsendt ' + 
			'et link til din telefon:</p>' + 
			'<input type="text" class="ttsend_nr" name="number" value="' + mobile_phone_no.substring(2) + '" />'+
			'<input type="hidden" name="ttcode" value="'+obj+'" />'+
			'&nbsp;<input type="image" class="ttsend_btn" onClick="ttsend_do(\'div_'+obj+'\');return false;" name="imageField" src="'+rootdir+'/img/butt_send.gif"/>'+
			'</form>';
	ttsenddiv = document.createElement("div");
	(isIE) ? ttsenddiv.setAttribute("className", "ttsend_div") : ttsenddiv.setAttribute("class", "ttsend_div");
	ttsenddiv.setAttribute("id", "div_"+obj);
	x = findPosX(tttd);
	y = findPosY(tttd);
	
	ttsenddiv.style.top = y+15 + 'px';
	ttsenddiv.style.left = x-100 + 'px';
	ttsenddiv.innerHTML = '<a href="#" onClick="ttsendclose(\'' + obj + '\');return false"><img src="' + rootdir + 'img/ttsend_close.gif" align="right" onClick="ttsendclose(\'' + obj + '\');" /></a>' + text ;
	thebody.appendChild(ttsenddiv);
}
function ttsendclose(obj) {
	try
		{
		document.getElementById('div_'+obj).style.display = 'none';
		}
	catch(err)
		{
		document.getElementById('div_imgbox'+obj).style.display = 'none';
		}	
}
function ttsend_do(obj) {
		var load_url = url + 'sendwaplink';
		var load_params = 'number='+obj.number.value+'&ttcode='+obj.ttcode.value+'&ptype='+obj.ptype.value;
		var formobj = obj;

		if(obj.number.value.length == 8) {
			loaddata(load_url + '&' + load_params, obj, 'ttwapsend');
		}
		else {
		alert("Du skal angive et gyldigt telefonnr.\r\rDu skal ikke taste din landekode.\r\rFormatet skal vÃ¦re xxxxxxxx");
		}
}

function logout_do(obj) {
		setCookie("SSOURL", document.location,"","/",".tdconline.dk",0);	
		var load_url = url + 'logout';
		var load_params = '';
		loaddata(load_url + '&' + load_params, '', 'logout');
}

function formparams(formobj) {
		var load_params = '';
		for (i=0;i<formobj.elements.length; i++) {
			if (formobj.elements[i].value != '')
				load_params +=  '&' + formobj.elements[i].name + '=' + formobj.elements[i].value;
		}
		return load_params;
}

function setCookie(name, value, expires, path, domain, secure) {
	document.cookie= name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name) {
	createCookie(name,"",-1);
}
function borderchange1() {
document.getElementById("carttable").style.border = "1px solid white";
setTimeout("borderchange2()",500);
}
function borderchange2() {
document.getElementById("carttable").style.border = "1px solid #dd5800";
setTimeout("borderchange3()",500);
}
function borderchange3() {
document.getElementById("carttable").style.border = "1px solid white";
setTimeout("borderchange4()",500);
}
function borderchange4() {
document.getElementById("carttable").style.border = "1px solid #dd5800";
}
