



var fileCount = 1;



          				var recipientCount = 1;
          				
          				



/****************************/



						function addRecipient()
          				{
          					recipientCount++; 
          					
          					//alert(recipientCount);
          					document.getElementById("recipient"+(recipientCount)).innerHTML +=
          					(
"<div id='recipient" + (recipientCount )+ "In'><table cellspacing='10' cellpadding='0' border='0'>" +
"								    <tr><td>" + LangConst["name"] + "</td><td><input type='text' name='recipientName" + (recipientCount) + "' id='recipientName" + (recipientCount) + "'></td><td>&nbsp;</td></tr>" +
"								    <tr><td>" + LangConst["email"] + "</td><td><input type='text' value='@' name='recipientEmail" + (recipientCount) + "' id='recipientEmail" + (recipientCount) + "'></td><td><a href='javascript:removeRecipient(" + (recipientCount ) +  ")'>" + LangConst["remove"] + "</a></td></tr>" + 
"							   	</table></div>" +
"							   	<div id='recipient" + (recipientCount+1) + "'></div> ");
          					
          				}
          				
          				function removeRecipient(no)
          				{
          					//alert(no);
          					document.getElementById("recipient"+(no) + "In").innerHTML = "";
          					// recipientCount--;
          				}
          				
          				function strpos(str, ch) 
          				{
							for (var i = 0; i < str.length; i++)
							if (str.substring(i, i+1) == ch) return i;
							return -1;
						}
						
          				function checkInputEmail(string)
          				{
          					
          					if(string == "@") return false;
          					if(strpos(string, "@") == -1) return false;
          					return true;
          				}
          				
          				function checkInfoMsg()
          				{
          					var email = "";

          					document.getElementById("recipientCount").value = recipientCount;

							//alert(document.getElementById("recipientCount").value);
							//return false;
          					
          					for(i = 1; i<= recipientCount; i++ )
          					{
       							email = document.getElementById("recipientEmail" + i).value;

       							//if(i==1 && email == "") return false;
       							//if(email == "") continue;
          					
	          					if(!checkInputEmail(email))
	          					{ 
	          						alert(LangConst["recipients"]);
	          						return false;
	          					}
          					}
          					
          					return true;
          				}
          				
          				
          				
          				
/****************************/


function anotherFile()
{
	fileCount++;
      document.getElementById("files"+(fileCount-1)).innerHTML+=
		'<input type="file" name="fileup['+']" size="' + LangConst["fileInputHtmlSize"] + '"><br /><div id="files'+(fileCount)+'"></div>';
}


function selectLink(id)
{
	document.getElementById(id).focus();
	document.getElementById(id).select();
}

function selectThis(th)
{
	th.focus();
	th.select();
}



function uploadStart()
{
  // timeRequestSend();
  AJAXStarted=true;
  //setInterval('timeRequestSend()', 4000); 
  //timeRequestSend();
  myrefresh=setInterval('timeRequestSend()',4000);

	document.getElementById("progressBg").style.display = "block";
}

/*
function timeRequestSend()
{
   if ((xmlhttp.readyState != 0 && xmlhttp.readyState != 4) || !AJAXStarted) return;
   
   xmlhttp.open("GET","./info/servertime_rpc.php?file=",true); 
   xmlhttp.onreadystatechange=timeRequestReceive;
   xmlhttp.send(null);
}*/

function hideProgressBar()
{
     	document.getElementById("progressBg").style.display = "none";
}

function timeRequestReceive()
{
  // alert("bas");
    if (xmlhttp.readyState == 4) 
    {
        var response = xmlhttp.responseXML;
        var res = response.getElementsByTagName('uploadPercent').item(0);
        //alert(xmlhttp.responseText.firstChild.text); 
        percent = Math.floor(res.firstChild.data);
        if(percent == '' || percent == 0) 
        {
        	clearInterval(myrefresh);
			hideProgressBar();
        }
        
        document.getElementById('progressPercent').innerHTML = percent + " %";
        setProgress(percent);
    }
} 

function setProgress(percent)
{
	document.getElementById("progressBar").style.width = Math.floor(percent * 3.35) + "px";
	//alert(document.getElementById("progressBar").style.width);
}

