
function dl_file(link) 
{
	window.open('http://www.securitysoftwarezone.com/force_download.php?link=' + link,'download','left=10,top=10,height=100,width=100,status=no,toolbar=no,menubar=no,scrollbars=yes,location=no');
}

function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

function trim(sString) 
{
	while (sString.substring(0,1) == ' ')
	{
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

	function change_it(change)
	{
		if ( change == 'enc1')
		{
			document.text_encrypt.enc_dec.value = 1;
			document.getElementById('submit_but').innerHTML = 'Begin Encryption';
			document.getElementById('conf_pass').style.visibility = 'visible';
			document.getElementById('conf_pass1').style.visibility = 'visible';
			document.getElementById('dec').innerHTML = 	"<table cellpadding='0' cellspacing='0' border='0'>" +
												"<tr>" +
												"	<td><img src='/user_files/images/left_tab_unselected.gif' style='display:block;'></td>" +
												"	<td background='/user_files/images/middle_tab_unselected.gif' style='padding-top: 5px;'><a class='but_tab' id='dec1' href='#' onclick='change_it(this.id)'>Decryption</a></td>" +
												"	<td><img src='/user_files/images/right_tab_unselected.gif' style='display:block;'></td>" +
												"</tr>" +
											"</table>";											

			document.getElementById('enc').innerHTML = 	"<table cellpadding='0' cellspacing='0' border='0'>" +
												"<tr>" +
												"	<td><img src='/user_files/images/left_tab_selected.gif' style='display:block;'></td>" +
												"	<td background='/user_files/images/middle_tab_selected.gif'><a class='rating_text' href='#' id='enc1' onclick='change_it(this.id)'>Encryption</a></td>" +
												"	<td><img src='/user_files/images/right_tab_selected.gif' style='display:block;'></td>" +
												"</tr>" +
											"</table>";											
		}
		else
		{
			document.text_encrypt.enc_dec.value = 2;
			document.getElementById('submit_but').innerHTML = 'Begin Decryption';
			document.getElementById('conf_pass').style.visibility = 'hidden';
			document.getElementById('conf_pass1').style.visibility = 'hidden';
			document.getElementById('enc').innerHTML = 	"<table cellpadding='0' cellspacing='0' border='0'>" +
												"<tr>" +
												"	<td><img src='/user_files/images/left_tab_unselected.gif' style='display:block;'></td>" +
												"	<td background='/user_files/images/middle_tab_unselected.gif' style='padding-top: 5px;'><a class='but_tab' id='enc1' href='#' onclick='change_it(this.id)'>Encryption</a></td>" +
												"	<td><img src='/user_files/images/right_tab_unselected.gif' style='display:block;'></td>" +
												"</tr>" +
											"</table>";											

			document.getElementById('dec').innerHTML = 	"<table cellpadding='0' cellspacing='0' border='0'>" +
												"<tr>" +
												"	<td><img src='/user_files/images/left_tab_selected.gif' style='display:block;'></td>" +
												"	<td background='/user_files/images/middle_tab_selected.gif'><a class='rating_text' href='#' id='dec1' onclick='change_it(this.id)'>Decryption</a></td>" +
												"	<td><img src='/user_files/images/right_tab_selected.gif' style='display:block;'></td>" +
												"</tr>" +
											"</table>";											
		}
			
	}

	function change_it_file(change)
	{
		if ( change == 'enc1')
		{
			document.file_encrypt.enc_dec.value = 1;
			document.getElementById('submit_but').innerHTML = 'Begin Encryption';
			document.getElementById('conf_pass').style.visibility = 'visible';
			document.getElementById('conf_pass1').style.visibility = 'visible';
			document.getElementById('dec').innerHTML = 	"<table cellpadding='0' cellspacing='0' border='0'>" +
												"<tr>" +
												"	<td><img src='/user_files/images/left_tab_unselected.gif' style='display:block;'></td>" +
												"	<td background='/user_files/images/middle_tab_unselected.gif' style='padding-top: 5px;'><a class='but_tab' id='dec1' href='#' onclick='change_it_file(this.id)'>Decryption</a></td>" +
												"	<td><img src='/user_files/images/right_tab_unselected.gif' style='display:block;'></td>" +
												"</tr>" +
											"</table>";											

			document.getElementById('enc').innerHTML = 	"<table cellpadding='0' cellspacing='0' border='0'>" +
												"<tr>" +
												"	<td><img src='/user_files/images/left_tab_selected.gif' style='display:block;'></td>" +
												"	<td background='/user_files/images/middle_tab_selected.gif'><a class='rating_text' href='#' id='enc1' onclick='change_it_file(this.id)'>Encryption</a></td>" +
												"	<td><img src='/user_files/images/right_tab_selected.gif' style='display:block;'></td>" +
												"</tr>" +
											"</table>";											
		}
		else
		{
			document.file_encrypt.enc_dec.value = 2;
			document.getElementById('submit_but').innerHTML = 'Begin Decryption';
			document.getElementById('conf_pass').style.visibility = 'hidden';
			document.getElementById('conf_pass1').style.visibility = 'hidden';
			document.getElementById('enc').innerHTML = 	"<table cellpadding='0' cellspacing='0' border='0'>" +
												"<tr>" +
												"	<td><img src='/user_files/images/left_tab_unselected.gif' style='display:block;'></td>" +
												"	<td background='/user_files/images/middle_tab_unselected.gif' style='padding-top: 5px;'><a class='but_tab' id='enc1' href='#' onclick='change_it_file(this.id)'>Encryption</a></td>" +
												"	<td><img src='/user_files/images/right_tab_unselected.gif' style='display:block;'></td>" +
												"</tr>" +
											"</table>";											

			document.getElementById('dec').innerHTML = 	"<table cellpadding='0' cellspacing='0' border='0'>" +
												"<tr>" +
												"	<td><img src='/user_files/images/left_tab_selected.gif' style='display:block;'></td>" +
												"	<td background='/user_files/images/middle_tab_selected.gif'><a class='rating_text' href='#' id='dec1' onclick='change_it_file(this.id)'>Decryption</a></td>" +
												"	<td><img src='/user_files/images/right_tab_selected.gif' style='display:block;'></td>" +
												"</tr>" +
											"</table>";											
		}
			
	}

function setSize() {

	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

  document.getElementById("modal_div").style.width = pageWidth;
  document.getElementById("modal_div").style.height = pageHeight;
	document.getElementById("modal_div").style.display = "block";
	document.getElementById("modal_img").style.display = "block";
	var t=setTimeout("document.file_encrypt.submit()", 500);
}
