function show_close_btn(div_id){
document.getElementById(div_id).style.visibility = "visible";
}
function show_sub(div_id){
if(document.getElementById(div_id).style.display == "block"){
document.getElementById(div_id).style.display = "none";
}else{
document.getElementById(div_id).style.display = "block";
}
}
function hide_close_btn(div_id){
document.getElementById(div_id).style.visibility = "hidden";
}
function close_dive(){
//document.getElementById("welcome").style.display="none";
     $("#welcome").hide("slow");
}
function hidetoolbar(div_id){
      $("#"+div_id).slideToggle("fast");
}

//Control panel
function openWindow(targett){
document.getElementById("controlWindow").style.visibility = "visible";
document.getElementById("controlWindow2").style.visibility = "hidden";


	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
	if(ajaxRequest.readyState == 1){
        document.getElementById("controlContainer").innerHTML = '<img src="images/ajax-loader.gif">';
    }

		if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById("controlContainer");
				ajaxDisplay.innerHTML = ajaxRequest.responseText;
				tinyMCE.execCommand('mceAddControl', true, 'about');
				tinyMCE.execCommand('mceAddControl', true, 'obj');
				tinyMCE.execCommand('mceAddControl', true, 'act');
				tinyMCE.execCommand('mceAddControl', true, 'messageor');
				tinyMCE.execCommand('mceAddControl', true, 'news');
				tinyMCE.execCommand('mceAddControl', true, 'ad');
				tinyMCE.execCommand('mceAddControl', true, 'memo');
		}
	}
	var queryString = "?target=" + targett;
	ajaxRequest.open("GET", "control.php" + queryString, true);
	ajaxRequest.send(null); 
	$.scrollTo( '#controlWindow', 800, {easing:'elasout'} );
}

/*function maximize(){
document.getElementById("controlWindow").style.width = "100%";
document.getElementById("controlWindow").style.height = "100%";
document.getElementById("controlWindow").style.right = "0px";
document.getElementById("controlWindow").style.top = "120px";
document.getElementById("controlWindow").style.bottom = "0px";
}*/
//------------------

//log in------------------
function login(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
	if(ajaxRequest.readyState == 1){
        document.getElementById("logg").innerHTML = '<table border="0"><tr><td><img src="images/show.gif"></td><td>Loading . . .</td></table>';
    }

		if(ajaxRequest.readyState == 4){
			
				window.location.reload();
			
				
		}
	}
	
	var queryString = "?username="+document.getElementById("username").value+"&password="+document.getElementById("password").value;
	ajaxRequest.open("GET", "login.php" + queryString, true);
	ajaxRequest.send(null); 
	
		
	
	
}function login2(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
	if(ajaxRequest.readyState == 1){
        document.getElementById("logg2").innerHTML = '<table border="0"><tr><td><img src="images/show.gif"></td><td>Loding . . .</td></table>';
    }

		if(ajaxRequest.readyState == 4){
			
				window.location.reload();
			
				
		}
	}
	
	var queryString = "?username="+document.getElementById("username2").value+"&password="+document.getElementById("password2").value;
	ajaxRequest.open("GET", "login.php" + queryString, true);
	ajaxRequest.send(null); 
	
		
	
	
}
function logout(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
	if(ajaxRequest.readyState == 1){
        document.getElementById("logg2").innerHTML = '<img src="images/show.gif">';
    }

		if(ajaxRequest.readyState == 4){
			
				window.location.reload();
			
				
		}
	}
	
	ajaxRequest.open("GET", "logout.php", true);
	ajaxRequest.send(null); 
	
		
	
	
}
