
var $img_loading = "<img src='styles/images/loading_animation_liferay.gif' /> "; 

var $msg = "<br>loading ....";
//Function to create an XMLHttp Object.
function getxmlhttp (){
	//Create a boolean variable to check for a valid Microsoft active x instanc
	var xmlhttp = false;
	//Check if we are using internet explorer.
	try {
	//If the javascript version is greater than 5.
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
		//If not, then use the older active x object.
		try {
		//If we are using internet explorer.
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
		//Else we must be using a non-internet explorer browser.
		xmlhttp = false;
		}
}
// If not using IE, create a 
// JavaScript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
//Function to process an XMLHttpRequest.
function helmi (serverPage, obj, getOrPost, str){
	var xmlhttp = false;
//Get an XMLHttpRequest object for use.
document.getElementById(obj).innerHTML = $img_loading+$msg; 
xmlhttp = getxmlhttp ();
if (getOrPost == "get"){
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById(obj).innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
} else {
xmlhttp.open("POST", serverPage, true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById(obj).innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(str);
}
}

//-----------------------------------------------------


function dwn2(bl, imag, mag_s1, mag_s2, bak, bakimg)
{ 
var oko;
var okok;
//var i=1;

		if(document.all[bl]){ //if 1
				if(document.all[bl].style.display=="none"){ //if 2
						
							
								if(document.all[bak].value=="false"){ // if 4
									document.all[bl].style.display="";
									document.all[bak].value=bl;
									document.all[imag].src=mag_s2;
									document.all[bakimg].value=imag;
									//document.getElementById(bl).innerHTML="vvvvvvvvvvvvvvv";
									//document.all[bl].id="shw";
									//document.all["mg"+bl].id="mgshw";
									} else{// else 4
									oko = document.all[bak].value;
									okok = document.all[bakimg].value;
									document.all[oko].style.display="none";
									document.all[okok].src=mag_s1;
									//document.all[bl].id="shw";
									//document.all["mg"+bl].id="mgshw";
									document.all[bl].style.display="";
									document.all[bak].value=bl;
									document.all[imag].src=mag_s2;
									document.all[bakimg].value=imag;
									} //end if 4
									
									
						
						//document.all["tt"+bl].value=document.all["shw"].id;
					
				} else{ 
				document.all[bl].style.display="none";
				document.all[imag].src=mag_s1;
				document.all[bak].value="false";
				document.all[bakimg].value="flase";
				} // end if 2
			} //end if 1
}

//*******************************

function dwn3(bl, imag, hhh, mag_s1, mag_s2)
{ 
//var i=1;

		if(document.all[bl]){ //if 1
				if(document.all[bl].style.display=="none"){ //if 2
					document.all[bl].style.display="";
					document.all[imag].src=mag_s2;
					document.all[hhh].innerHTML="hidden";
					} else if(document.all[bl].style.display!="none"){ // else if 2
					document.all[bl].style.display="none";
					document.all[imag].src=mag_s1;
					document.all[hhh].innerHTML="show";
					} //end if 2
				
					
			} //end if 1
}



//-----------------------------------------------------





//-----------------------------------------------------


function dwn4(bl, imag, mag_s1, mag_s2)
{ 
var oko;
var okok;
//var i=1;

		if(document.all[bl]){ //if 1
				if(document.all[bl].style.display=="none"){ //if 2
						
							
								if(document.all['backmenu'].value=="false"){ // if 4
									document.all[bl].style.display="";
									document.all['backmenu'].value=bl;
									//document.all[imag].src=mag_s2;
									//document.all['bakimg'].value=imag;
									//document.getElementById(bl).innerHTML="vvvvvvvvvvvvvvv";
									//document.all[bl].id="shw";
									//document.all["mg"+bl].id="mgshw";
									} else{// else 4
									oko = document.all['backmenu'].value;
									//okok = document.all['bakimg'].value;
									document.all[oko].style.display="none";
									//document.all[okok].src=mag_s1;
									//document.all[bl].id="shw";
									//document.all["mg"+bl].id="mgshw";
									document.all[bl].style.display="";
									document.all['backmenu'].value=bl;
									//document.all[imag].src=mag_s2;
									//document.all['bakimg'].value=imag;
									} //end if 4
									
									
						
						//document.all["tt"+bl].value=document.all["shw"].id;
					
				} else{ 
				document.all[bl].style.display="none";
				//document.all[imag].src=mag_s1;
				document.all['backmenu'].value="false";
				//document.all['bakimg'].value="flase";
				} // end if 2
			} //end if 1
}

//*******************************


function deleing(titdel ,iddel ,pags)
{



if (confirm("Are you sure to delete ("+titdel+") ?")) {
//helmi('news_delete_image.php?id='+iddel+'&del_final='+document.all['del_tndr'][1].value,'axshow');
window.open(pags+'&id='+iddel+'&del=yes', 'poppage', 'toolbars=1, scrollbars=1, location=0, statusbars=1, menubars=1, resizable=1, width=100, height=100, left = 150, top = 50');
}
else {
//alert ("No, you did not type "+"ppppppppp"+", did you?  OK.  Guess ya did.");
   }  

}