function clearDefaultandCSS(el) {
  if (el.defaultValue==el.value) el.value = ""
  if (el.style) el.style.cssText = ""
}

function limitText(limitField, limitCount, limitNum, VaihdaVari) {
	if (limitField.value >= limitNum) {
		limitCount.value = "<? print $pricerule2;?>";
        document.getElementById("textfield_lottery_2").style.color = "red";

		} else {
		limitCount.value = "<? print $normal;?>";
		document.getElementById("textfield_lottery_2").style.color = "black";
		}
}

function popitup(url) {
	newwindow=window.open(url,'name','height=620,width=580, toolbar=no, scrollbars=yes, resizable=yes');
	if (window.focus) {newwindow.focus()}
	return false;
}

function lightup(imageobject, opacity){
 if (navigator.appName.indexOf("Netscape")!=-1
  &&parseInt(navigator.appVersion)>=5)
    imageobject.style.MozOpacity=opacity/100
 else if (navigator.appName.indexOf("Microsoft")!= -1 
  &&parseInt(navigator.appVersion)>=4)
    imageobject.filters.alpha.opacity=opacity
}


    function addBookmark(title,url) {
    if (window.sidebar) { 
    window.sidebar.addPanel(title, url,""); 
    } else if( document.all ) {
    window.external.AddFavorite( url, title);
    } else if( window.opera && window.print ) {
    return true;
    }
    }

var content = "Tervehdys kaikki hyvän ruoan ja ruoanlaiton ystävät!~Meiltä löydät laajan valikoiman keittiövälineitä ja herkkuja edulliseen hintaan. Tervetuloa ostoksille!";

function twDisplayTW() {twDisplay('tw',content,0);}
loaded('tw',twDisplayTW);

var brk = '~'; // character to use for line break
var resetTime = 0; // set to 0 to not reset or seconds to delay before reset

// Typewriter Text Javascript
// copyright 13th October, 2007 by Stephen Chapman
// permission to use this Javascript on your web page is granted
// provided that all of the code in this script (including these
// comments) is used without any alteration
// you can change the values above this notice to suit your requirements
function twDisplay(id,content,num) {
	var delay = 50; 
	if (num <= content.length)  {
		var lt = content.substr(0,num); document.getElementById(id).innerHTML = lt.replace(RegExp(brk,'g'),'<br \/>'); num++; 
			if (num > content.length) delay = resetTime * 1000;
		} 
		else {document.getElementById(id).innerHTML = ''; num = 0;} 
		if (delay > 0) setTimeout('twDisplay("'+id+'","'+content+'","'+num+'")',delay);} 
		var pageLoaded = 0; window.onload = function() {pageLoaded = 1;}; 
		function loaded(i,f) {
			if (document.getElementById && document.getElementById(i) != null) f(); 
		else if (!pageLoaded) setTimeout('loaded(\''+i+'\','+f+')',4000);}








