var j=1;
function showDownloadForm(element)
{
	document.getElementById('darkenback').style.visibility = 'visible';
	document.getElementById('darkenback').style.zIndex = 400;
	document.getElementById('downloaddetails').style.visibility = 'visible';
	document.getElementById('downloaddetails').style.zIndex = 450;
        document.getElementById('downloaddetails').style.left = (screen.width/2)-200;
//alert(screen.width + " x " + ((screen.height/2)-80));
        document.getElementById('downloaddetails').style.top = (screen.height/2)-160;


}

function showForm(element)
{
	document.getElementById('downloaddetails').style.visibility = 'visible';
	document.getElementById('downloaddetails').style.zIndex = 450;

}

function showFormDetails(element)
{
    document.getElementById('detailsform').style.zIndex = 102;
	//document.getElementById('downloaddetails').style.visibility = 'visible';
	
	for (i=0;i<13000;i++)
	{
	    if (i==0)
	    {
	        alert("start");
	        startMove();
	    }    
	    
//	    if (i==12900)
//	    {
//	        stopTimer();   
//	        alert("stop");
//	    }
//	    for (k=0;k<5000;k++){};
//	    
	    //window.status(i);   
	}
	
//show_alert();
}

function startDownload(element)
{
    alert(document.getElementById('detailsform') + " Start downloading");

}

function show_alert(element)
{
     alert(" Start downloading");

}


function startMove(element)
{
    alert("move " + j + " : " + document.getElementById('detailsform').style.top);
    
    document.getElementById('detailsform').style.position="relative";
    document.getElementById('detailsform').style.top= document.getElementById('detailsform').style.top + j;
    j++;
    
    timer=setTimeout("startMove()",10);
}

function stopTimer()
{
    clearTimeout(timer);
    
}
function validateName(field)
{
    //alert("email validator");
    with(field)
    {
        //alert(value);
        if (value=="")
            {alert("Please enter your Name");return false;}
        else {return true;}    
    }
}

function validateEmail(field)
{
    //alert("email validator");
    with(field)
    {
        //alert(value);
        if (value=="")
            {alert("Please enter your e-mail address");return false;}
            
        apos=value.indexOf("@");
        dotpos=value.lastIndexOf(".");
        if (apos<1||dotpos-apos<2)
            {alert("Not a valid e-mail address");return false;}
        else {return true;}    
    }
}

function Send_Mail(emailfeild, namefiled)
{
    var subject='USBCopyNotify Downloaded';
    var body='sdsd';
    
    //alert("Sending mail ");
    alert(emailfeild.value + " : " + namefiled.value);
    window.location="mailto:ivan@cyspl.com?subject="+subject+"&body="+body;
    return true;
}
function form_validation(thisform)
{
    //alert("validator");
    with (thisform)
    {
        if(validateName(fname) == false)
        {
            fname.focus();
            return false;
        }
    }
    with (thisform)
    {
        if(validateEmail(email) == false)
        {
            email.focus();
            return false;
        }
    }
    
    //alert("Sending mail");
    //Send_Mail(thisform.email, thisform.fname);
//return true;
}