
//Illustrations

var xmlHttp 		=	createXmlHttpRequestObject();
var serverAddress 	=   "validate.php?name12=";


/**** TRIM FUNCTIONS START*********/
function LTrim(str)
{
  var whitespace = new String(" \t\n\r");

  var s = new String(str);

  if (whitespace.indexOf(s.charAt(0)) != -1) {
    // We have a string with leading blank(s)...

    var j=0, i = s.length;

    // Iterate from the far left of string until we
    // don't have any more whitespace...
    while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
    j++;


    // Get the substring from the first non-whitespace
    // character to the end of the string...
    s = s.substring(j, i);
  }

  return s;
}
function RTrim(str)
{
  // We don't want to trip JUST spaces, but also tabs,
  // line feeds, etc.  Add anything else you want to
  // "trim" here in Whitespace
  var whitespace = new String(" \t\n\r");

  var s = new String(str);

  if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
    // We have a string with trailing blank(s)...

    var i = s.length - 1;       // Get length of string

    // Iterate from the far right of string until we
    // don't have any more whitespace...
    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
      i--;


    // Get the substring from the front of the string to
    // where the last non-whitespace character is...
    s = s.substring(0, i+1);
  }

  return s;
}
function Trim(str)
{
  return RTrim(LTrim(str));
}

/****** TRIM FUNCTIONS END ********/

/* --------- Get Extension of filename ------------*/
 function getExt(filename)
	{
	   var dot_pos = filename.lastIndexOf(".");
	   if(dot_pos == -1)
		  return "";
	   return filename.substr(dot_pos+1).toLowerCase();
	}
/******* END ********/

function events_validate()
{
	
	ename = document.getElementById('ename').value;	
	if(Trim(ename) == '')
	{
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid #969696 1px ; color:black;'><img src='./index_files/icon.gif' width='15' height='15'>Event Name should not be empty</div>";
		return false;
	}
	venue = document.getElementById('venue').value;	
	if(Trim(venue) == '')
	{
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid #969696 1px ; color:black;'><img src='./index_files/icon.gif' width='15' height='15'>Venue should not be empty</div>";
		return false;
	}
	desc = document.getElementById('desc').value;
	if(Trim(desc) == '')
	{
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid #969696 1px ; color:black;'><img src='./index_files/icon.gif' width='15' height='15'>Description should not be empty</div>";
		return false;
	}
	img  = document.getElementById('upload_image').value;
	
	if(img!= '')
	{
		
	   var ext = getExt(img);

	   if(ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "gif" || ext =="bmp")
	   	{	
			document.getElementById('display').innerHTML="";
			return true;
		}
		else
		  {
			alert("upload images only");
			return false;
		  }
	
	}
	else
	{
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid #969696 1px ; color:black;'><img src='./index_files/icon.gif' width='15' height='15'>Image name should not be empty</div>";
		return false;
	}
	return true;
}
function partner_validate()
{
	
	org = document.getElementById('org').value;	
	email = document.getElementById('email').value;
	url = document.getElementById('url').value;	
	role = document.getElementById('role').value;
	
	if(Trim(org) == '')
	{
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid #969696 1px ; color:black;'><img src='./index_files/icon.gif' width='15' height='15'>Organization should not be empty</div>";
		return false;
	}
	if(Trim(email) == '')
	{
	document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid #969696 1px ; color:black;'><img src='./index_files/icon.gif' width='15' height='15'>Email should not be empty</div>";
		return false;
	}
	else
	{
		resemail=emailval(email);
            if(resemail==false)
		    {
				document.getElementById('display').innerHTML="<BR><BR><div align='center' style='padding:5px;background-color:#E5E5E5;border:solid #969696 1px ; color:black;'><img src='./index_files/icon.gif' width='15' height='15'>&nbsp;&nbsp;Enter valid Email</div>";
			return false;
			}
	}
	if(Trim(url) == '')
	{
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid #969696 1px ; color:black;'><img src='./index_files/icon.gif' width='15' height='15'>URL should not be empty</div>";
		return false;
	}
	if(Trim(role) == '')
	{
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid #969696 1px ; color:black;'><img src='./index_files/icon.gif' width='15' height='15'>Role should not be empty</div>";
		return false;
	}
	return true;
}
function reviewer_validate()
{
	
	name = document.getElementById('name').value;	
	org = document.getElementById('org').value;
	email = document.getElementById('email').value;
	resume = document.getElementById('resume').value;
	if(Trim(name) == '')
	{
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid #969696 1px ; color:black;'><img src='./index_files/icon.gif' width='15' height='15'>Name should not be empty</div>";
		return false;
	}
	if(Trim(org) == '')
	{
	document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid #969696 1px ; color:black;'><img src='./index_files/icon.gif' width='15' height='15'>Organization should not be empty</div>";
		return false;
	}
	if(Trim(email) == '')
	{
	document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid #969696 1px ; color:black;'><img src='./index_files/icon.gif' width='15' height='15'>Email should not be empty</div>";
		return false;
	}
	else
	{
		resemail=emailval(email);
            if(resemail==false)
		    {
				document.getElementById('display').innerHTML="<BR><BR><div align='center' style='padding:5px;background-color:#E5E5E5;border:solid #969696 1px ; color:black;'><img src='./index_files/icon.gif' width='15' height='15'>&nbsp;&nbsp;Enter valid Email</div>";
			return false;
			}
	}
	if(Trim(resume) == '')
	{
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid #969696 1px ; color:black;'><img src='./index_files/icon.gif' width='15' height='15'>Resume should not be empty</div>";
		return false;
	}
	return true;
}


function addepcenter()
{
		
	company=document.getElementById('organization').value;
	city=document.getElementById('city').value;
	country=document.getElementById('country').value;
	
	if(company=='')
	{
		
		document.getElementById('display1').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid red 1px ; color:red;'><img src='icon.gif' width='15' height='15'>Organization should not be empty</div>";
		return false;
	}
	if(city=='')
	{
		
		document.getElementById('display1').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid red 1px ; color:red;'><img src='icon.gif' width='15' height='15'>City should not be empty</div>";
		return false;
	}
	if(country=='')
	{
		
		document.getElementById('display1').innerHTML="<div align='center' style='padding:5px;background-color:#e5e5e5;border:solid red 1px ; color:red;'><img src='icon.gif' width='15' height='15'>Country should not be empty</div>";
		return false;
	}
		
	return true;
}


function createXmlHttpRequestObject() {
	var xmlHttp;
	try {
		xmlHttp = new XMLHttpRequest();
	}
	catch(e) {
		var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP");
		for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++) {
			try {
				xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
			}
			catch (e) {} 
		}
	}
	if (!xmlHttp)
		alert("Your Browser Does not Support AJAX Architecture");
	else
		return xmlHttp;
}

function checkUserId(username) {
	if(xmlHttp) {
		xmlHttp.open("GET", serverAddress+username, true);
		xmlHttp.onreadystatechange = handleRequestStateChange;
		xmlHttp.send(null);
	}
}

function handleRequestStateChange() {
	if (xmlHttp.readyState==4) {
		var targetObj =document.getElementById('spanbox');
		targetObj.innerHTML=xmlHttp.responseText;
	if(targetObj.innerHTML==''){
targetObj.style.visibility = 'hidden';	
targetObj.style.display = 'none';
		}
else{
targetObj.style.visibility = 'visible';	
targetObj.style.display = 'block';
		targetObj.innerHTML = '<img src="icon.gif" width="13" height="13" border="0" alt="">&nbsp;&nbsp;' + xmlHttp.responseText;
		return false;
		}
		
	}
}

function display(id)
  {

  document.getElementById("content").innerHTML= document.getElementById(id).innerHTML
  }
//Reviewer registration

function reviewer(id)
  {

  document.getElementById("content").innerHTML= document.getElementById(id).innerHTML
  }
//editors registration
function banner(id)
  {

  document.getElementById("content").innerHTML= document.getElementById(id).innerHTML
  }
function editors(id)
  {

  document.getElementById("content").innerHTML= document.getElementById(id).innerHTML
  }
function list(id)
  {

  document.getElementById("contents").innerHTML= document.getElementById(id).innerHTML
  }
//sections
function sections_add(id)
  {

  document.getElementById("add").innerHTML= document.getElementById(id).innerHTML
  }
//Reviewer
function reviewer_invite(id)
  {

  document.getElementById("content").innerHTML= document.getElementById(id).innerHTML
  }
 //subscriber
function subscriber_invite(id)
  {

  document.getElementById("content").innerHTML= document.getElementById(id).innerHTML
  }
//editors and Registration......

function isEmpty(str){
return (str.length == 0 || str=='')?true:false;
}

function isAlpha(str){
	var alpha = /^([a-zA-Z]+)$/;
	return alpha.test(str);
}

function isNumeric(str){
	var numeric = /^([\d]+)$/ ;
	return numeric.test(str);
}

function isAlphaNumeric(str){
	var alphaNumeric = /^([0-9a-zA-Z]+)$/
	return alphaNumeric.test(str);
}

function isValidEmail(str){
var email = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i; 
return email.test(str);
}

function isValidDate(str){
var dob = /^([\d]{2})(\/|-)([\d]{2})(\/|-)([\d]{4})$/;
return dob.test(str);
}

function isValidPhoneNo(str){
var phoneNo = /^([\d]{11})$/;
return phoneNo.test(str);
}

function isValidURL(str){
	
var url = /^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([\w]+)(.[\w]+){1,2}$/;
return url.test(str);
}

function isValid(srcId,targetId,validations,error){
var  valids = validations.split('|');
var srcObj = document.getElementById(srcId);
var targetObj = document.getElementById(targetId);
var srcValue = srcObj.value;
var errorMess = error.split("|");


for(num in valids){
/*alert(errorMess[num]);*/
switch(valids[num]){
		case 'isEmpty':
			validationResult = (isEmpty(srcValue))?errorMess[num]:'';
		break;
		case 'isNumeric':
			validationResult = (!isNumeric(srcValue))?errorMess[num]:'';
		break;
		case 'isAlpha':
			validationResult = (!isAlpha(srcValue))?errorMess[num]:'';
		break;
		case 'isAlphaNumeric':
			validationResult = (!isAlphaNumeric(srcValue))?errorMess[num]:'';
		break;
		case 'isValidEmail':
			validationResult = (!isValidEmail(srcValue))?errorMess[num]:'';
		break;
		case 'isValidDate':
			validationResult = (!isValidDOB(srcValue))?errorMess[num]:'';
		break;
		case 'isValidPhoneNo':
			validationResult = (!isValidPhoneNo(srcValue))?errorMess[num]:'';
		break;
		case 'isValidURL':
			validationResult = (!isValidURL(srcValue))?errorMess[num]:'';
		break;
		default:
		break;
		}//End Switch Case
	if(!isEmpty(validationResult)){
		targetObj.className = 'error';
		targetObj.style.visibility = 'visible';		
		targetObj.innerHTML = '<img src="icon.gif" width="13" height="13" border="0" alt="">&nbsp;&nbsp;' + validationResult;
		return false;
	}//End If
	else {
	targetObj.style.visibility = 'hidden';
	targetObj.className = 'noerror';
	targetObj.innerHTML = '';
	}
	}//End For Loop
}//End Function isValid
function writeHelpText(id,message){
obj = document.getElementById(id);
obj.className = 'help';
obj.innerHTML = message;
}

function help()
{
window.open ("./help.html",
"mywindow","menubar=1,resizable=1,height=450,width=550,toolbar=no,menubar=yes,scrollbars=yes"); 
 }
function login_help()
{
  window.open ("./login_help.php",
"mywindow","menubar=1,resizable=1,height=450,width=550,toolbar=no,menubar=yes,scrollbars=yes"); 
 }
function body_help()
{
  window.open ("./body_help.html",
"mywindow","menubar=1,resizable=1,height=450,width=550,toolbar=no,menubar=yes,scrollbars=yes"); 
 }

 function formating_help()
{
  window.open ("./formating_help.html",
"mywindow","menubar=1,resizable=1,height=450,width=550,toolbar=no,menubar=yes,scrollbars=yes"); 
 }

		


// ///////Date Function////
function today(){
	var d=new Date();
	var date=d.getDate();        
	var mon=d.getMonth();
	var month = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
	var year=d.getFullYear();
	var hour=d.getHours();
	document.writeln(date+"  "+month[mon]+"  "+year);
}

/////////Advertisements.....
function adv_validation()
{ 
	
	name	=	document.getElementById('name').value;
	company	=	document.getElementById('company').value;
	image	=	document.getElementById('image').value;
	loc 	=	document.getElementById('loc').value;
	pages	=	document.getElementById('pages').value;
	
	if(name	==	'')
	{
		alert("Please Enter The Name...");
		return false;
	}
	if(company	==	'')
	{
		alert("Please Enter The Company...");
		return false;
	}
		if(image	==	'')
	{
		alert("Please Select The Image...");
		return false;
	}
		if(loc	==	'right')
	{
		alert("Please Enter The Location...");
		return false;
	}
		if(pages	==	'all')
	{
		alert("Please Enter The Pages...");
		return false;
	}

}

////Reviewers
function reviewer_validation()
{ 
    
	email	=	document.getElementById('reviewer').value;
	
	if(email	==	'')
	{
		alert("Please Enter The Email-Ids...");
		return false;
	}
}
/////Manu Script Validation
function manu_validation()
{
	file		=	document.getElementById('file').value;
    video		=	document.getElementById('video').value;
	title		=	document.getElementById('title').value;

	if(file	==	'')
	{
		
	}
	else
	{
		 name = file_validation();
         if(name==false)return false;
	}

    if(title	==	'')
	{

	}
	
	if(video	==	'')
	{

	}
	else
	{
		 name = video_validation();
         if(name==false)return false;
	}
return true;
}

function file_validation()
{
	v =	document.getElementById('file').value;

	var ext = v.lastIndexOf('.');
	var extStr = v.substring((ext+1),(v.length));
	if(extStr != 'pdf' && extStr != 'doc' && extStr != 'rtf' )
	{
	  document.getElementById('manu').innerHTML="<div align='center' style='padding:5px;background-color:#E5E5E5;border:solid gray 1px ; color:red;'><img src='icon.gif' width='15' height='15'>&nbsp;&nbsp;Only PDF or DOC or RTF files are allowed</div>";
	  return false;
   }
   
}

function video_validation()
{
	v =	document.getElementById('video').value;

	var ext = v.lastIndexOf('.');
	var extStr = v.substring((ext+1),(v.length));
	if(extStr != 'avi' && extStr != 'wmv' && extStr != 'mov' && extStr != 'mpeg' && extStr != 'flv' && extStr != 'jpg' && extStr != 'tiff' && extStr != 'AVI' && extStr != 'WMV' && extStr != 'MOV' && extStr != 'MPEG' && extStr != 'FLV' && extStr != 'JPG' && extStr != 'TIFF' && extStr != 'jpeg' && extStr != 'JPEG' )
	{
	  document.getElementById('manu').innerHTML="<div align='center' style='padding:5px;background-color:#E5E5E5;border:solid gray 1px ; color:red;'><img src='icon.gif' width='15' height='15'>&nbsp;&nbsp;Only AVI or WMV or WOV or FLV or MPEG or JPG or TIFF videos are allowed</div>";
	  return false;
   }
   
}
/////Change Password...............
function change_passvalid()
{   
         password=document.getElementById("newpassword").value;
         oldpass=document.getElementById("oldpass").value;
         cpassword= document.getElementById("cpassword").value;
         email=document.getElementById('primary_email').value;
       
         if(email=='')
         {
       
            document.getElementById ('display').innerHTML="<div align='center' style='padding:5px;background-color:#E5E5E5;border:solid #969696 1px ; color:black;'><img src=' icon.gif' width='15' height='15'>&nbsp;&nbsp;Email should not be empty</div>";
            //document.getElementById('primary_email').focus();
            return false;
          }
          else
          {
            resemail=emailval(email);
            if(resemail==false)
            {
                document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#E5E5E5;border:solid #969696 1px ; color:black;'><img src=' icon.gif' width='15' height='15'>&nbsp;&nbsp;Enter valid Email</div>";
            return false;
            }

          }

          if(oldpass=='')
          {
            document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#E5E5E5;border:solid #969696 1px ; color:black;'><img src=' icon.gif' width='15' height='15'>&nbsp;&nbsp;Old Password should not be empty</div>";
            return false;
          }
          if(password == '')
          {
                document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#E5E5E5;border:solid #969696 1px ; color:black;'><img src=' icon.gif' width='15' height='15'>&nbsp;&nbsp;Password should not be empty</div>";
            return false;
          }
          else
          {
            res=passvalidation(password);
            if(res==false)return false;
          }

          /* ConfirmationPassword Validation*/
           if(cpassword == '')
         {
            document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#E5E5E5;border:solid #969696 1px ; color:black;'><img src=' icon.gif' width='15' height='15'>&nbsp;&nbsp;Confirm Password should not be empty</div>";
            return false;
        }
        else
        {
            res7=cpassvalidation(cpassword);
            if(res7==false)return false;
        }
}
function passvalidation(pwd)
    {
        for(i=0;i<pwd.length;i++)
        {
            password1=pwd.length;
            if(password1<6)
            {
        document.getElementById("display").innerHTML="<div align='center' style='padding:5px;background-color:#E5E5E5;border:solid #969696 1px ; color:black;'><img src=' icon.gif' width='15' height='15'>&nbsp;&nbsp;Please Enter Minimum of 6 Characters for Password</div>";
        return false;
            }
        }
    }

    function cpassvalidation(cpwd)
    {
        for(i=0;i<cpwd.length;i++)
        {
            cpassword1=cpwd.length;       
            if(((password!=cpassword)&&(password1!=cpassword1))||((password!=cpassword)&&(password1=cpassword1)))
            {
                document.getElementById("display").innerHTML="<BR><BR><div align='center' style='padding:5px;background-color:#E5E5E5;border:solid #969696 1px ; color:black;'><img src=' icon.gif' width='15' height='15'>&nbsp;&nbsp;New Password & Confirmation Password Should be Same</div>";
                return false;
            }
        }
    } 
////End Change Password........................

////Toll-Tip.............

/***********************************************
* Fixed ToolTip script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
		
var tipwidth='150px' //default tooltip width
var tipbgcolor='#EEEEEE'  //tooltip bgcolor
var disappeardelay=250  //tooltip disappear speed onMouseout (in miliseconds)
var vertical_offset="0px" //horizontal offset of tooltip from anchor link
var horizontal_offset="-3px" //horizontal offset of tooltip from anchor link

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="fixedtipdiv" style="visibility:hidden;width:'+tipwidth+';background-color:'+tipbgcolor+'" ></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, tipwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
}
return edgeoffset
}

function fixedtooltip(menucontents, obj, e, tipwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidetip()
dropmenuobj=document.getElementById? document.getElementById("fixedtipdiv") : fixedtipdiv
dropmenuobj.innerHTML=menucontents

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", tipwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
}

function hidetip(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidetip(){
if (ie4||ns6)
delayhide=setTimeout("hidetip()",disappeardelay)
}

function clearhidetip(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

function home_reg()
{
	//alert('hii');
	email=document.getElementById('primary_email').value;
	if(email=='')
	{
		
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#FFFFCC;border:solid red 1px ; color:red;'><img src='icon.gif' width='15' height='15'>Email should not be empty</div>";
        //document.getElementById('primary_email').focus();
		return false;
	}
	else
	{
	        resemail=emailvalidation(email);
             if(resemail==false)
            {
                document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#E5E5E5;border:solid gray 1px ; color:red;'><img src='icon.gif' width='15' height='15'>&nbsp;&nbsp;Enter valid Email</div>";
            return false;
            }

	}
return true;

}
function emailvalidation(str)
{
	var email = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i; 
    return email.test(str);
}

function banner_ins()
{
	
	banner=document.getElementById('banner').value;
	if(banner=='')
	{
		
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#FFFFCC;border:solid red 1px ; color:red;'><img src='icon.gif' width='15' height='15'> Banner should not be empty</div>";
        //document.getElementById('primary_email').focus();
		return false;
	}
	else
	{ 
         var ext = banner.lastIndexOf('.');
	     var extStr = banner.substring((ext+1),(banner.length));
	     if((extStr != 'gif')&&(extStr != 'jpg')&&(extStr != 'png'))
	     {
	       document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#FFFFCC;border:solid red 1px ; color:red;'><img src='icon.gif' width='15' height='15'> Only GIF or JPEG or PNG Images are allowed</div>";
	       return false;
         }

	}
}
function adminform()
{
	
	email=document.getElementById('primary_email').value;
	if(email=='')
	{
		
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#E5E5E5;border:solid #969696  1px ; color:red;'><img src='icon.gif' width='15' height='15'> Email should not be empty</div>";
        //document.getElementById('primary_email').focus();
		return false;
	}
	else
	{
	        resemail=emailval(email);
            if(resemail==false)
		    {
				document.getElementById('display').innerHTML="<BR><BR><div align='center' style='padding:5px;background-color:#E5E5E5;border:solid #969696 1px ; color:black;'><img src=' icon.gif' width='15' height='15'>&nbsp;&nbsp;Enter valid Email</div>";
			return false;
			}

	}
return true;
}

function emailval(str)
{
	var email = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i; 
    return email.test(str);
}

function adminadd()
{
	
	name=document.getElementById('name').value;
	company=document.getElementById('company').value;
	desc=document.getElementById('desc').value;
	image=document.getElementById('image').value;
	url=document.getElementById('url').value;
	
	if(name=='')
	{		
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#FFFFCC;border:solid red 1px ; color:red;'><img src='icon.gif' width='15' height='15'>Adv Name should not be empty</div>";
		return false;
	}
	if(company=='')
	{
		
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#FFFFCC;border:solid red 1px ; color:red;'><img src='icon.gif' width='15' height='15'>Adv Company should not be empty</div>";
		return false;
	}if(desc=='')
	{
		
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#FFFFCC;border:solid red 1px ; color:red;'><img src='icon.gif' width='15' height='15'>Adv Description should not be empty</div>";
		return false;
	}if(image=='')
	{
		
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#FFFFCC;border:solid red 1px ; color:red;'><img src='icon.gif' width='15' height='15'>Adv Image should not be empty</div>";
		return false;
	}
	else
	{
         var ext = image.lastIndexOf('.');
	     var extStr = image.substring((ext+1),(image.length));
	     if((extStr != 'gif')&&(extStr != 'jpg')&&(extStr != 'png'))
	     {
	       document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#FFFFCC;border:solid red 1px ; color:red;'><img src='icon.gif' width='15' height='15'> Only GIF or JPEG or PNG Images are allowed</div>";
	       return false;
         }
	}
	
	if(url=='')
	{
		
		document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#FFFFCC;border:solid red 1px ; color:red;'><img src='icon.gif' width='15' height='15'>Adv URL should not be empty</div>";
		return false;
	}

}
function adminsection()
{
	
	name=document.getElementById('name').value;
	des=document.getElementById('de').value;

	if(name=='')
	{		
		document.getElementById('display').innerHTML="<BR><BR><div align='center' style='padding:5px;background-color:#E5E5E5;border:solid #969696 1px ; color:black;'><img src=' icon.gif' width='15' height='15'>&nbsp;&nbsp;Name should not be empty</div>";
		return false;
	}if(des=='')
	{		
		document.getElementById('display').innerHTML="<BR><BR><div align='center' style='padding:5px;background-color:#E5E5E5;border:solid #969696 1px ; color:black;'><img src=' icon.gif' width='15' height='15'>&nbsp;&nbsp;Description should not be empty</div>";
		return false;
	}
}
function manuscript_contact()
{   
    phone_no=document.getElementById('phone_no').value;
    email=document.getElementById('email').value;
    if(phone_no=='')
    {       
        document.getElementById('display').innerHTML="";
    }
    else
    {
        resmob=mobilevalidation(phone_no);
        if(resmob == false)
        {
            return false;   
        }
    }
    if(email=='')
     {
        document.getElementById('display').innerHTML="";
     }
     else
    {
            resemail=emailval(email);
            if(resemail==false)
            {
                document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#E5E5E5;border:solid gray 1px ; color:red;'><img src='icon.gif' width='15' height='15'>&nbsp;&nbsp;Enter valid Email</div>";
            return false;
            }

          }
}
function mobilevalidation(mv)
    {
        for(i=0;i<mv.length;i++)
        {
            if(!(mv.charAt(i)>=0 && mv.charAt(i)<=9))
            {
                document.getElementById('display').innerHTML="<div align='center' style='padding:5px;background-color:#E5E5E5;border:solid gray 1px ; color:red;'><img src='icon.gif' width='15' height='15'>&nbsp;&nbsp;Enter the number b/w(0-9)</div>";
                document.getElementById('phone_no').focus();
                return false;
            }
        }
    }
function displayContent(obj,divID){
	if(obj.innerHTML=="+")obj.innerHTML="-";
	else obj.innerHTML="+";
	x = document.getElementById(divID);
	if(x.style.display=="none")x.style.display="block";
	else x.style.display="none";
}

function displayManuscript(obj,divID){
	x = document.getElementById(divID);
	if(x.style.display=="none")x.style.display="block";
	else x.style.display="none";
}

 function sendMail(name,to,from,sub,mess,mid,uid){
	name = 'mail';
	document.getElementById('mailCont').style.display = 'block';
	document.getElementById('mailCont').style.posTop = 800;
	document.forms[name].elements[0].value = to ;
	document.forms[name].elements[1].value = to ;
	document.forms[name].elements[2].value = to ;
	document.forms[name].elements[3].value = from ;
	document.forms[name].elements[4].value = sub ;
	document.forms[name].elements[5].value = mess ;
	document.forms[name].elements[6].value = mid ;
	document.forms[name].elements[7].value = uid ;
 }
function loadMessage(formName,fieldName,value){
document.forms[formName].elements[fieldName].value = document.getElementById(value).innerHTML;
/*alert(formName + fieldName + value + document.getElementById(value).innerHTML);*/
}
//alert(getMailMessage('http://www.jafib.com/admin/addCommentToManuscript.php',24,4458,'getManuscriptValidationIdByReviewer'));

function loadMailMessage(formName,fieldName,value){

}

function addCommentToManuscript(mid,uid){
/*alert(mid + uid);*/
document.getElementById('addCommentToManu').style.display = 'block';
	document.forms['addComment2Manuscript'].elements['mid'].value = mid ;
	document.forms['addComment2Manuscript'].elements['rid'].value = uid ;
}
 
function createAjax(){
	var ua;
	if(window.XMLHttpRequest) {
		try {
			ua = new XMLHttpRequest();
			}
			catch(e) {
				ua = false;
			}
		}
	else if(window.ActiveXObject) {
		try {       
			ua = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(e) {
				ua = false;
			}
		}   
	return ua;   
}


function getMailMessage(file,mid,uid,func){
/*alert(file+mid+uid+func);*/
var req = createAjax();
var url = file+'?mid='+mid+'&uid='+uid+'&func='+func ;
	req.open('GET',url,true);
	req.onreadystatechange = function(){
		if(req.readyState == 4){
			if(req.status == 200 ){
				return req.responseText ;
			}
		}
	}
	req.send();
}
function updateValueInTable(file,mid,field,value,func,targetOBJ){
/*alert(file+mid+uid+func);*/
var req = createAjax();
var url = file+'?mid='+mid+'&field='+field+'&value='+value+'&func='+func ;
	req.open('GET',url,true);
	req.onreadystatechange = function(){
		if(req.readyState == 4){
			if(req.status == 200 ){
				targetOBJ.innerText = req.responseText ;
			}
		}
	}
	req.send();
}
function section_saved()
{
alert('Section Saved');
document.getElementById('sec_saved').innerHTML = "Saved";

}

function preview_saved()
{
alert('Preview Status Saved');

}
function sendError(mess,func,file){
alert(mess+func+file);
/*
var req = createAjax();
var url = file+'?mess='+mess+'&func='+func ;
	req.open('GET',url,true);
	req.onreadystatechange = function(){
		if(req.readyState == 4){
			if(req.status == 200 ){
				return req.responseText ;
			}
		}
	}
	req.send();*/
}


	/************************************************************************************************************
	(C) www.dhtmlgoodies.com, September 2005
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
	Thank you!
	
	www.dhtmlgoodies.com
	Alf Magne Kalleland
	
	************************************************************************************************************/	
    var charIndex = -1;
    var stringLength = 0;
    var inputText;
    function writeContent(init){
    	if(init){
    		inputText = document.getElementById('contentToWrite').innerHTML;
    	}
        if(charIndex==-1){
            charIndex = 0;
            stringLength = inputText.length;
        }
        var initString = document.getElementById('myContent').innerHTML;
		initString = initString.replace(/<SPAN.*$/gi,"");
        
        var theChar = inputText.charAt(charIndex);
       	var nextFourChars = inputText.substr(charIndex,4);
       	if(nextFourChars=='<BR>' || nextFourChars=='<br>'){
       		theChar  = '<BR>';
       		charIndex+=3;
       	}
        initString = initString + theChar + "<SPAN id='blink'>_</SPAN>";
        document.getElementById('myContent').innerHTML = initString;

        charIndex = charIndex/1 +1;
		if(charIndex%2==1){
             document.getElementById('blink').style.display='none';
        }else{
             document.getElementById('blink').style.display='inline';
        }
                
        if(charIndex<=stringLength){
            setTimeout('writeContent(false)',57);
        }else{
        	blinkSpan();
        }  
    }
    
    var currentStyle = 'inline';
    function blinkSpan(){
    	if(currentStyle=='inline'){
    		currentStyle='none';
    	}else{
    		currentStyle='inline';
    	}
    	document.getElementById('blink').style.display = currentStyle;
    	setTimeout('blinkSpan()',500);
    	
    }
    