﻿
//used 'add new manuscript - add authors table' 
function SetUniqueRadioButton(current)
{
   for(i = 0; i < document.forms[0].elements.length; i++)
   {
      elm = document.forms[0].elements[i]
      if (elm.type == 'radio')
      {
            elm.checked = false;  
      }
   }
   current.checked = true;
}

function SetUniqueRadioButtonDiffrentCorrespondingAuthor(current)
{
    if(!confirm('The corresponding author you have indicated is a different person. Will this author become the corresponding author?'))
    { 
        current.checked = false; 
        return false;
    }
    else
        SetUniqueRadioButton(current)
}

function switchContent(obj, obj2){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var el2 = document.getElementById(obj2);
	
	//var ar = document.getElementById("content").getElementsByTagName("DIV");
		if(el.style.display == "none"){
//			for (var i=0; i<ar.length; i++){
//				if (ar[i].className=="sub"){ 
//				    ar[i].style.display = "none";
//					}
//                		
//			}

            $("#"+obj).show("slow");
           //el.style.display = "block";					
		}else{
		    $("#"+obj).hide("slow");
			//el.style.display = "none";		
		}
	}
}
function OpenWindow(strLink)
{
     var ChatWindowConfig='toolbar=no, location=no, directories=no, menubar=no, scrollbars=yes';
    
    var leftStr = (window.screen.width/2)-800/2;
    
    if (navigator.appName.indexOf("Microsoft")>=0) {
        ChatWindowConfig+=',left='+leftStr+',top=10,width=800,height=860';
    }else{
        ChatWindowConfig += ',screenX='+leftStr+',screenY=10,width=750,height=860';
    }
    
    window.open(strLink, null, ChatWindowConfig);
}

function OpenSelectWindow(strLink)
{
     var ChatWindowConfig='toolbar=no, location=no, directories=no, menubar=no, scrollbars=yes';
    
    var leftStr = (window.screen.width/2)-800/2;
    
    if (navigator.appName.indexOf("Microsoft")>=0) {
        ChatWindowConfig+=',left='+leftStr+',top=10,width=720,height=1000';
    }else{
        ChatWindowConfig += ',screenX='+leftStr+',screenY=10,width=750,height=1000';
    }
    
    window.open(strLink, null, ChatWindowConfig);
}

function OpenNotifyArtFriendWindow(strLink)
{
     var ChatWindowConfig='toolbar=no, location=no, directories=no, menubar=no, scrollbars=yes';
    
    var leftStr = (window.screen.width/2)-800/2;
    
    if (navigator.appName.indexOf("Microsoft")>=0) {
        ChatWindowConfig+=',left='+leftStr+',top=10,width=550,height=740';
    }else{
        ChatWindowConfig += ',screenX='+leftStr+',screenY=10,width=750,height=1000';
    }
    
    window.open(strLink, null, ChatWindowConfig);
}


function ViewPDF(baseId,revId,fileName)
{
    var WindowConfig='toolbar=no, location=no, directories=no, menubar=no, scrollbars=yes';
    
    var leftStr = (window.screen.width/2)-800/2;
    
    if (navigator.appName.indexOf("Microsoft")>=0) {
        WindowConfig+=',left='+leftStr+',top=10,width=800,height=1000';
    }else{
        WindowConfig += ',screenX='+leftStr+',screenY=10,width=750,height=1000';
    }
    var str = "../ViewPDF.aspx?baseId=" + baseId+"&revId="+revId+"&fileName="+fileName;
    newwindow=  window.open(str, "", WindowConfig);  
    newwindow.focus();      
   // if (window.focus) {newwindow.focus()}


}

function validationPopUp(msg) {

    alert(msg);

}

function LocationAfterSubmit(loc) {

    window.location = loc;
}
function LocationSearch()       
{
    var queryString = new String();
    queryString = window.location.search;            
    queryString = queryString.substring(1);            
    document.getElementById("div1").innerHTML = queryString + "<br />";            
    var arr1 = new Array();            
    arr1 = queryString.split("&");            
    var arr2 = new Array();            
    for(var i = 0; i<arr1.length; i++)            
    {            
        arr2[i] = arr1[i].toString().substring(arr1[i].toString().indexOf("=") + 1);                
        arr1[i] = arr1[i].toString().substring(0,arr1[i].toString().indexOf("="));            
    }            
    document.getElementById("div1").innerHTML += arr1.concat() + "<br />";            
    document.getElementById("div1").innerHTML += arr2.concat();        
}        
function setLocationSearch(valueObj)        
{            
    window.location.search = valueObj;        
}

function clear_meSubSection(obj){
    if (obj.value == " - Sub Section - ") {
       obj.value = ""; 
    }
}
function fill_meSubSection(obj)
{
    if (obj.value != "") {
       return;
    }
    else
    {
        obj.value = " - Sub Section - ";
    }
}

function ViewCln(divName)
{ 
    var visible = document.getElementById(divName); 
    
    if(visible.style.display == 'none')
    {
        visible.style.display = 'block';                  
    }
    else
    {
        visible.style.display = 'none';         
    }
}

function UpdateManuNumWatched(manuId,ip)
{
    $.ajax({   type: "POST",   
                url: "../Handlers/UpdateManuNumWatched.ashx",   
                data: "manuId="+manuId+"&ip="+ip,   
                success: function(msg){    },   
                error: function(XMLHttpRequest, textStatus, errorThrown){      } });
      
}

function switchSubscribe(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var el2 =document.getElementById("divSortSubscribe");

		if(el.style.display == "none"){
            $("#"+obj).show("slow");
            $("#divSortSubscribe").hide();			
		}else{
		    $("#"+obj).hide("slow");
		     $("#divSortSubscribe").show();		
		}
	}
}

 
