<!--

var overImg = null;
var normImg = null;

var loadDone = false;

var hwnd = null;

////////////////////////////////////////////////////////////////////////

/* function for body.onLoad */

function initPage() {
	/*
	preloadMenu(7);
	loadDone = true;
	*/
}
/* functions for menu and other images */
function preloadMenu(count) {
	overImg = new preloadImages(count,'/data/images/menu/menu-','-on.gif')
	normImg = new preloadImages(count,'/data/images/menu/menu-','-off.gif')
}

function preloadImages(length, path, type) {
    for(var i = 1; i <= length; i++) {
	this[i]= new Image();
	this[i].src= path + i + type;
    }
    return this;
}

function rollOn(num) {
    if(loadDone && document.images) { 
	eval('document.images["m-'+num+'"].src='+'overImg[num].src')
    }
}

function rollOff(num) {
    if(loadDone && document.images){
	eval('document.images["m-'+num+'"].src='+'normImg[num].src')
    }
}

////////////////////////////////////////////////////////////////////////

/*Directory Listing*/
function addop(){
	var listObj = document.getElementById("txtPCList");
	var ListObjTwo = document.getElementById("txtPCSelect");
	
	if(listObj.type){
		for(var i = 0; i < listObj.length; i++) {
			if(listObj.options[i].selected){
				if(repetitionop(listObj.options[i].text)){
					ListObjTwo.options[ListObjTwo.length] = new Option(listObj.options[i].text, listObj.options[i].value);
				}	
			}
		}
	}
}

function removeop(){
	var ListObjTwo = document.getElementById("txtPCSelect");
                     var lengthListObjTwo = ListObjTwo.length;
	
	if(ListObjTwo.type){
		for(var i = 0; i < ListObjTwo.length; i++) {
			if(ListObjTwo.options[i].selected){
				ListObjTwo.remove(i);
                i--;
			}
		}
	}
}

function repetitionop(objone){
	var ListObjTwo = document.getElementById("txtPCSelect");
	
	if(ListObjTwo.type){
		for(var i = 0; i < ListObjTwo.length; i++) {			
			if(String(ListObjTwo.options[i].text) == String(objone)){		
				return false;
			}			
		}
	}
	return true;
}

function selectedop(){
	var ListObjTwo = document.getElementById("txtPCSelect");
                     var sStr = "";	

	if(ListObjTwo.type){
		for(var i = 0; i < ListObjTwo.length; i++) {	
                                                                if(i == 0){sStr = ListObjTwo[i].value; } else {sStr += ", " + ListObjTwo[i].value; }
		}
                      document.f.elemsl.value = sStr;
	}	
}

function sameInf(){
                      var Sci = document.getElementById("sci");
  
                      if(Sci.checked == true){
                               document.f.txtCompany.value = document.f.txtYourName.value;
                               document.f.txtEmailAddress_c.value = document.f.txtEmailAddress.value;
                               document.f.txtPhone_c.value = document.f.txtPhone.value;
                               document.f.txtFaxNumber_c.value = document.f.txtFaxNumber.value;
                               document.f.txtStreetAddress_c.value = document.f.txtStreetAddress.value;
                               document.f.txtCity_c.value = document.f.txtCity.value;
                               document.f.txtZipCode_c.value = document.f.txtZipCode.value;
                               document.f.txtState_c.value = document.f.txtState.value;

                               document.f.txtCompany.disabled = true;
                               document.f.txtEmailAddress_c.disabled = true;
                               document.f.txtPhone_c.disabled = true;
                               document.f.txtFaxNumber_c.disabled = true;
                               document.f.txtStreetAddress_c.disabled = true;
                               document.f.txtCity_c.disabled = true;
                               document.f.txtZipCode_c.disabled = true;
                               document.f.txtState_c.disabled = true;
                      } else {
                               document.f.txtCompany.value = "";
                               document.f.txtEmailAddress_c.value = "";
                               document.f.txtPhone_c.value = "";
                               document.f.txtFaxNumber_c.value = "";
                               document.f.txtStreetAddress_c.value = "";
                               document.f.txtCity_c.value = "";
                               document.f.txtZipCode_c.value = "";
                               document.f.txtState_c.value = "Select State";

                               document.f.txtCompany.disabled = false;
                               document.f.txtEmailAddress_c.disabled = false;
                               document.f.txtPhone_c.disabled = false;
                               document.f.txtFaxNumber_c.disabled = false;
                               document.f.txtStreetAddress_c.disabled = false;
                               document.f.txtCity_c.disabled = false;
                               document.f.txtZipCode_c.disabled = false;
                               document.f.txtState_c.disabled = false;
                      }

                      return true;
}

function sameInfTwo(){
                      var Sci = document.getElementById("sci");

                      if(Sci.checked == true){                               
                               document.f.txtCompany.disabled = true;
                               document.f.txtEmailAddress_c.disabled = true;
                               document.f.txtPhone_c.disabled = true;
                               document.f.txtFaxNumber_c.disabled = true;
                               document.f.txtStreetAddress_c.disabled = true;
                               document.f.txtCity_c.disabled = true;
                               document.f.txtZipCode_c.disabled = true;
                               document.f.txtState_c.disabled = true;
                      } 
}

function ChangesConInf(str){

                      var Sci = document.getElementById("sci");

                      if(Sci.checked == true){  
                                   switch (str) {
                                             case "name" : document.f.txtCompany.value = document.f.txtYourName.value; break;
                                             case "email" : document.f.txtEmailAddress_c.value = document.f.txtEmailAddress.value; break;
                                             case "phone" : document.f.txtPhone_c.value = document.f.txtPhone.value; break;
                                             case "fax" : document.f.txtFaxNumber_c.value = document.f.txtFaxNumber.value; break;
                                             case "address" : document.f.txtStreetAddress_c.value = document.f.txtStreetAddress.value; break;
                                             case "city" : document.f.txtCity_c.value = document.f.txtCity.value; break;
                                             case "zip" : document.f.txtZipCode_c.value = document.f.txtZipCode.value; break;
                                             case "state" : document.f.txtState_c.value = document.f.txtState.value; break;
                                   }                             
                                   
                      } 

}
/*end Directory Listing*/


function sizeImg(obj, _width) {
    var tmpImg = new Image();
    tmpImg.src = obj.src;
    if (tmpImg.width > _width) { obj.width = _width; }
}
function SIP(obj, _w, _h) {
  /////////////// this is the correct function is proportional to change size
  var tmpImg = new Image();
  tmpImg.src = obj.src;
  //alert(tmpImg.width)
  if (_w/tmpImg.width > _h/tmpImg.height) {
  	if (tmpImg.width > _w) {
      obj.height = tmpImg.height*(_w/tmpImg.width);
      obj.width = _w;
    }
    if (tmpImg.height > _h) {
		  obj.width = tmpImg.width*(_h/tmpImg.height);
		  obj.height = _h;
    }
	} else {
    if (tmpImg.height > _h) {
		  obj.width = tmpImg.width*(_h/tmpImg.height);
		  obj.height = _h;
    }
  	if (tmpImg.width > _w) {
      obj.height = tmpImg.height*(_w/tmpImg.width);
      obj.width = _w;
    }
  }
}


////////////////////////////////////////////////////////////////////////

/* function to open print\email window */

function PrinterFriendly(url) {
    var width = 700;
        height = 550;

    remote = window.open("http://" + getDomainName() + url, "opener", "scrollbars=1,resizable=0,toolbar=1,left=" + ((screen.availWidth  - width) / 2) + ",top=" + ((screen.availHeight  - height) / 2) + ",width=" + width + ",height=" + height);

    if (remote.opener == null) remote.opener = window;
}

function PrinterFriendlyNoPopup(url) {
    var width = 700;
        height = 550;

    remote = window.open("http://" + getDomainName() + url, "_self");

    if (remote.opener == null) remote.opener = window;
}

function PrinterFriendly760(url) {
    var width = 760,
        height = 430;
    remote = window.open("http://" + getDomainName() + url, "opener", "menubar=0,scrollbars=0,resizable=0,toolbar=0,left=" + ((screen.availWidth  - width) / 2) + ",top=" + ((screen.availHeight  - height) / 2) + ",Width=" + width + ",height=" + height);
    if (remote.opener == null) remote.opener = window;
}


function getDomainName() {
	var url = window.location.href;
	var end = url.indexOf("/", 7);
	if (end == -1) { end = url.length; }
	return url.substring(7, end);
}

/* function that show tip on your status bar when you take mouse over print\email link */
function showText(obj) {
    obj.onmouseout = function() { window.status = ""; }
    window.status = obj.innerText;
}

function showPoll(url) {
    if (hwnd == null || (hwnd != null && hwnd.closed)) {
	hwnd = showWindow(url);
    } else { hwnd.focus(); }
}

function showWindow(url) {
    var width = 500,
        height = 400;

    hwnd = window.open(url, "Results", "left=" + ((screen.availWidth  - width) / 2) + ",top=" + ((screen.availHeight  - height) / 2) + ",width=" + width + ",height=" + height + ",titlebar=1,resizable=1,scrollbars=1");
    hwnd.focus();

    return hwnd;
}

////////////////////////////////////////////////////////////////////////

/* functions that check different forms for correct information */

function checkRegForm(formobj) {
    with(formobj) {
	if (email.value.length == 0) { alert("Please, enter your email."); email.focus(); return false; }
	if (!checkEmail(email.value)) { alert("Please, enter valid email address."); email.focus(); return false; }
	if (cemail.value.length == 0) { alert("Please, confirm your email."); cemail.focus(); return false; }
	if (email.value != cemail.value) { alert("Email confirmation failed."); cemail.focus(); return false; }
    }

    return true;
}


function trim(sInString){
  return sInString.replace(/(^\s+)|(\s+$)/g,"");
}

function checkEmail(email) {
    var myRegExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    return myRegExp.test(email);
}
function checkMail(email) {
    var myRegExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    return myRegExp.test(email);
}

// Check google search form

function checkChoise() {
	if (document.getElementById("fulltxt").checked) {
		window.location.href = "http://www2.us.elsevierhealth.com/inst/serve?action=searchform&id=jem";
		return false;
	} else if (document.getElementById("q").value.length == 0) {
		return false;
	}
	return true;
}

function setSiteHomePage( anchor, divId, linkId ){
	var url = window.location.href;
if (document.all){
	anchor.style.behavior='url(#default#homepage)';
	anchor.setHomePage(url);
} else {
	divPopup = document.getElementById(divId);
	divPopup.style.display = "block";
	hpLink = document.getElementById(linkId);
	hpLink.href=url;
}
return true;
}
function closePopup(divId){
	document.getElementById(divId).style.display = "none";
}

function signPanelFormSubmit( form ){
	form.url_from_sign_panel.value = window.location.href;
	return true;
}
function addLoadEvent(func) {
        var oldonload = window.onload;
        if (typeof window.onload != 'function') {
                window.onload = func;
        }
        else {
                window.onload = function() {
                        oldonload();
                        func();
                }
        }
}

function addEvent(el, eType, fn, uC) {
	if (el.addEventListener) {
		el.addEventListener(eType, fn, uC);
		return true;
	} else if (el.attachEvent) {
		return el.attachEvent('on' + eType, fn);
	} else {
		el['on' + eType] = fn;
	}
} 
function processGoogleSearch(){
	var keyword = document.forms["cse-search-box"]["q"].value  ; 
	keyword = keyword.replace(/[:]/ig, "" ).toLowerCase() ;
	var found  = document.getElementById('cse-search-results').offsetHeight > 260 ;
	p.prop7 = (found ? "" : "null:")  + keyword ; 
	for ( var prop in p ){ s[prop] = p[prop]; }
	var s_code=s.t();if(s_code)document.write(s_code);
}
//-->
