function openWin(sourceFile,winWidth,winHeight){
   if (document.all) window.open(sourceFile,"PopUp","height="+(winHeight)+",width="+(winWidth)+",innerWidth="+winWidth+",innerHeight="+winHeight+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no");
   else window.open(sourceFile,"PopUp","innerWidth="+(winWidth)+",innerHeight="+(winHeight)+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no");
}

function openWin(sourceFile,winWidth,winHeight,xPos,yPos){
   if (document.all) window.open(sourceFile,"PopUp","height="+(winHeight)+",width="+(winWidth)+",innerWidth="+winWidth+",innerHeight="+winHeight+",left="+xPos+",top="+yPos+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no");
   else window.open(sourceFile,"PopUp","innerWidth="+(winWidth)+",innerHeight="+(winHeight)+",left="+(xPos)+",top="+(yPos)+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no");
}

function openNamedPopUp(popupName, sourceFile,xPos,yPos,winWidth,winHeight, scrollbars){
   if (document.all) window.open(sourceFile, popupName ,"height="+(winHeight)+",width="+(winWidth)+",scrollbars="+scrollbars+",innerWidth="+winWidth+",innerHeight="+winHeight+",left="+xPos+",top="+yPos+",toolbar=no,location=no,status=no,menubar=no,resizable=no");
   else window.open(sourceFile, popupName ,"innerWidth="+(winWidth)+",innerHeight="+(winHeight)+",left="+(xPos)+",top="+(yPos)+",scrollbars="+scrollbars+",toolbar=no,location=no,status=no,menubar=no,resizable=no");
}


function changeImgSrc(tag, filename) {
	if (tag != null) {
		var currentTagSrc = tag.src;
		var path = "";
		idx = currentTagSrc.lastIndexOf("/");
		if (idx != -1 && filename.charAt(0) != '/') {
			path = currentTagSrc.substring(0, idx) + "/";
		}
		tag.src = path + filename;
	}
}

function sendForm(formname, command){
   document.forms[formname].elements['command'].value = command;
   document.forms[formname].submit();
   return false;
}

function preloadImages() {
    var d=document; if(d.images) { if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=preloadImages.arguments;
    for(i=0; i<a.length; i++)
            if (a[i].indexOf("#")!=0) {
                d.MM_p[j]=new Image;
                d.MM_p[j++].src=a[i];
            }
        }
}

function submitFormWithReturn(e, formname) {
    var key;
    if(window.event)
        key = window.event.keyCode;//IE
    else
        key = e.which; //FireFox
    if(key == 13) {
        document.forms[formname].submit();
    }
}		      
 var tid		= false;
 var weiter	= true;

 function getWinningNumbers(s) {
     if(tid) {
         clearTimeout(tid);
         tid = false;
     }
     if(weiter) {
         tid				= setTimeout("doSubmitWinningNumbers()",400);
     }
 }

 function doSubmitWinningNumbers() {
     weiter = false;
     setTimeout("weiter=true",1000);
     //document.forms[0].submit();
     document.forms.GameHistoryForm.submit();
 }
