function exp_clp_user_panel(id)
{
	var elem = id.nextSibling;
	while(elem.nodeType != 1){
   		elem = elem.nextSibling;
	} 
	
	if(elem.style.display == ''){
		id.style.backgroundColor = 'white';
		elem.style.display = 'block';
		id.style.color = 'black';
	}
	else{
		id.style.backgroundColor = '';
		elem.style.display = '';
		id.style.color = '';
	}
}
//-----------------------Expand & Collapse Volumes list
function exp_clp_volumes(id)
{
	var elem = id.nextSibling;
	while(elem.nodeType != 1){
   		elem = elem.nextSibling;
	} 
	
	if(elem.style.display == ''){
		id.style.backgroundImage = "url(images/minus.png)";
		elem.style.display = 'block';
	}
	else{
		id.style.backgroundImage = "url(images/plus.png)";
		elem.style.display = '';
	}
}
//-----------------------Login Form Validation
function Inint_AJAX() 
{
   try { return new ActiveXObject("Msxml2.XMLHTTP");  } catch(e) {} //IE
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE
   try { return new XMLHttpRequest();          } catch(e) {} //Native Javascript
   alert("XMLHttpRequest not supported");
   return null;
};

function check_fields() 
{
     var req = Inint_AJAX();
     req.onreadystatechange = function () { 
          if (req.readyState==4) {
               if (req.status==200) {
					if(req.responseText == 'success')
						window.location = 'index.php';
					else
						document.getElementById('login_msg').innerHTML=req.responseText; //retuen value
               } 
          }
     };
	 var username = document.Login.username.value;
	 var password = document.Login.password.value;
	 var type	  = document.Login.type.value;
     req.open("GET", "includes/codes/login_ajax.php?u="+username+"&p="+password+"&t="+type); //make connection
     req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); // set Header
     req.send(null); //send value
}
/* //-----------------------Show Article Abstract
function show_abstract(id) 
{
	var elem = id.nextSibling;
	alert(elem.tagName);
	while(elem.nodeType != 1){
   		elem = elem.nextSibling;
	} 
	if(elem.style.display == '')
		alert('YES');
    /*  var req = Inint_AJAX();
     req.onreadystatechange = function () { 
          if (req.readyState==4) {
               if (req.status==200) {
					if(req.responseText == 'success')
						window.location = 'index.php';
					else
						document.getElementById('login_msg').innerHTML=req.responseText; //retuen value
               } 
          }
		  else
			
     };
	 var username = document.Login.username.value;
	 var password = document.Login.password.value;
     req.open("GET", "includes/codes/login_ajax.php?u="+username+"&p="+password); //make connection
     req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); // set Header
     req.send(null); //send value
} */
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,'');
}
//-----------------------Search section
function chk_src_from()
{
	var All		= document.search.src_all.value.trim();
	var Author	= document.search.src_author.value.trim();
	var Title	= document.search.src_title.value.trim();
	var msg = '';
	
	if( (All.length<1) && (Author.length<1) && (Title.length<1) )
	{
		alert('Enter search keyword');
		return false;
	}
	else 
	{
		if(All.length<4 && All.length>0)
				msg = "'All fields' Must be more than 4 word\n";
		if(Author.length<3 && Author.length>0)
				msg += "'Author' Must be more than 3 word\n";
		if(Title.length<4 && Title.length>0)
				msg += "'Title' Must be more than 4 word\n";
		if(msg != ''){
			alert(msg);
			return false;
		}
	}
	return true;
}
