var x;
function showLogin(msg) {
	txt = '';
	txt += '<div class="login-popup"> ';
	txt += '<div class="login-close"> <a href="#"><img src="images/icon_delte_up.gif" alt="close" name="closepop" width="21" height="21" border="0" id="closepop" onmouseover="MM_swapImage(\'closepop\',\'\',\'images/icon_delte_over.gif\',1)" onmouseout="MM_swapImgRestore()" onclick="closeWait()" /></a></div>';
	txt += '<div class="login-title">Security Professional Login  </div>';
	if (msg) txt += '<div class="login-error">' + msg +  ' </div>';
	txt += '<div class="login-row">';
	txt += '<div class="login-label">User Name</div>';
	txt += '<div class="login-field-holder"><input class="login-field" id="username" type="text" /> </div>';
	txt += '</div>';
	txt += '<div class="login-row">';
	txt += '<div class="login-label">Password</div>';
	txt += '<div class="login-field-holder"><input class="login-field" id="password" type="password" /> </div>';
	txt += '</div>';
	txt += '<div class="login-bttn-row">';
	txt += '<div class="bttn-eventpop"><a href="#self" onclick="login();">Login</a></div> ';
	txt += '</div>';
	txt += '<div class="login-link">Forgot your Password?</div>';
	txt += '<div class="login-link"><a href="#">Click Here.</a></div>';
	txt += '<div class="exaccess-link"> <a href="index.php?o=register">Register now for Extended  Site Access &nbsp;<img src="images/arrow_white_right.png" border="0" /></a></div>';
	txt += '</div>';
	showOverlay();
	box(txt);
}

function login() {
	el = document.getElementById("username");
	el2 = document.getElementById("password");
	url = "index.php?o=login&user=" + encode(el.value) + "&pwd=" + md5(el2.value);
	initObj();
	showWait();
	if (xmlhttp!=null) {
	  xmlhttp.onreadystatechange=_login;
	  xmlhttp.open("GET",url,true);
	  xmlhttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
	  xmlhttp.send(null);
	}
}


function _login() {
	if(checkReadyState(xmlhttp)) {
		var response = xmlhttp.responseXML.documentElement;
		response.normalize;
		ret=response.getElementsByTagName("ret");
		msg = getXMLNode(ret);
		if (msg == "ok")
		{
			window.location="index.php?n=ftp";
		} else {
			message("Your username or password don't match");
		}
	}
}

function createFolder(parentFolder) {
	txt = '';
	txt += '<div class="login-popup"> ';
	txt += "<form action='index.php?n=ftp&o=create_folder&id=" + parentFolder + "' method='POST'>";
	txt += '<div class="login-close"> <a href="#"><img src="images/icon_delte_up.gif" alt="close" name="closepop" width="21" height="21" border="0" id="closepop" onmouseover="MM_swapImage(\'closepop\',\'\',\'images/icon_delte_over.gif\',1)" onmouseout="MM_swapImgRestore()" onclick="closeWait()" /></a></div>';
	txt += '<div class="login-title">Create new folder</div>';
	txt += '<div class="login-row">';
	txt += '<div class="login-label" style="color: #000;">Folder Name</div>';
	txt += '<div class="login-field-holder"><input class="login-field" name="Name" type="text" /> </div>';
	txt += '</div>';
	txt += '<div class="login-bttn-row">';
	txt += '<div class="bttn-eventpop"><a href="#self" onclick="document.forms[0].submit();">CREATE FOLDER</a></div> ';
	txt += '</div>';
	txt += "</form></div>";
	showWait(txt);
}

function browseFile(parentFolder) {
	txt = '';
	txt += '<div class="login-popup"> ';
	txt += "<form action='index.php?n=ftp&o=upload_file&id=" + parentFolder + "' method='POST' enctype='multipart/form-data' target='uploadArea'>";
	txt += '<div class="login-close"> <a href="#"><img src="images/icon_delte_up.gif" alt="close" name="closepop" width="21" height="21" border="0" id="closepop" onmouseover="MM_swapImage(\'closepop\',\'\',\'images/icon_delte_over.gif\',1)" onmouseout="MM_swapImgRestore()" onclick="closeWait()" /></a></div>';
	txt += '<div class="login-title">Upload file</div>';
	txt += '<div class="login-row">';
	txt += '<div class="login-label" style="color: #000;">File</div>';
	txt += '<div class="login-field-holder"><input class="login-field" name="FileName" type="file" /> </div>';
	txt += '</div>';
	txt += '<div class="login-row">';
	txt += '<div class="login-label" style="color: #000;">Description</div>';
	txt += '<div class="login-field-holder"><input class="login-field" name="Description" type="text" /> </div>';
	txt += '</div>';
	txt += '<div class="login-bttn-row">';
	txt += '<div class="bttn-eventpop"><a href="#self" onclick="document.forms[0].submit(); showWait();">START UPLOAD</a></div> ';
	txt += '</div>';
	txt += "</form></div>";
	showWait(txt);

}

function _uploadFile() {
	window.location.reload(); 
}


function completeUpload() {

}

function rowOver(obj) {
//	m = obj.getElementsByTagName("td");

}

function rowOut(obj) {

}

function displayMove(id) {
	url = "index.php?n=ftp&o=get_move&id=" + id;
	initObj();
	showWait();
	if (xmlhttp!=null) {
	  xmlhttp.onreadystatechange=_displayMove;
	  xmlhttp.open("GET",url,true);
	  xmlhttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
	  xmlhttp.send(null);
	}
}


function _displayMove() {
	if(checkReadyState(xmlhttp)) {
		var response = xmlhttp.responseXML.documentElement;
		response.normalize;
		ret=response.getElementsByTagName("ret");
		msg = getXMLNode(ret);
		message(msg);
	}
}

function playVideo(id) {
	url = "index.php?n=ftp&o=get_movie&id=" + id;
	initObj();
	showWait();
	if (xmlhttp!=null) {
	  xmlhttp.onreadystatechange=_playMovie;
	  xmlhttp.open("GET",url,true);
	  xmlhttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
	  xmlhttp.send(null);
	}
}

function _playMovie() {
	if(checkReadyState(xmlhttp)) {
		var response = xmlhttp.responseXML.documentElement;
		response.normalize;
		ret=response.getElementsByTagName("ret");
		msg = "<div style='width:640x; height: 500px;'>" + getXMLNode(ret) + "</div>";
		message(msg);
	}
}