        
var imagewindow  = null;
var dloadwindow;

function s_sleep(sec)
{
	var d, s, a, e;

        d = new Date; 
        s = d.getSeconds();
        do
        {
        	d = new Date;
        	a = d.getSeconds();
        	e = a-s;
        	if (e<0)
        	   e +=60;
	}
	while(e<sec)
}

function m_sleep(sec)
{
	var d, s, a, e;

	if (sec>=1000)
	{
		s_sleep(sec/1000);
		sec=sec%1000;
	}

        d = new Date; 
        s = d.getMilliseconds();
        do
        {
        	d = new Date;
        	a = d.getMilliseconds();
        	e = a-s;
        	if (e<0)
        	   e +=1000;
	}
	while(e<sec)
}


        function openImage(image,iwith,iheight)
        {

                lwith = iwith + 20;
                lheight = iheight + 30;

                if (imagewindow!=null)
                {
                        imagewindow.close();
                        
                        //opera has some sort of race on the states... sleep 500 ms :)
                        m_sleep(500);
                        
                }

                imagewindow=window.open(image,'ImageWindow', 'width='+lwith+',height='+lheight+',scrollbars=no,toolbar=no,location=no,status=no,menubar=no,top=50,left=50');


                //imagewindow.document.writeln('<html><title>'+image+'</title><body bgcolor=black><img src="'+image+'" border="0" width="'+iwith+'" height="'+iheight+'"><br></table></body></html>');
                //window.opener=self;
        }

function loginIsSubmitting()
{
	alert ("wew");
	return true;
}

function openWindow(theurl)
{
	//alert(theurl);
	dloadwindow=window.open(theurl,'dloadwindow','width=400,height=300,scrollbars=no,toolbar=no,location=no,status=no,menubar=no,top=50,left=50');	

	if(dloadwindow.document==null)
	{
	}
	
	var xx = dloadwindow.document.getElementById("loginform");
	
	if(xx!=null)
	{
		xx.onsubmit=loginIsSubmitting;
	}
}

