sas_tmstp=Math.round(Math.random()*10000000000);sas_masterflag=1;
function SmartAdServer(sas_pageid,sas_formatid,sas_target) {
 if (sas_masterflag==1) {sas_masterflag=0;sas_master='M';} else {sas_master='S';};
 document.write('<SCR'+'IPT SRC="http://www2.smartadserver.com/call/pubj/' + sas_pageid + '/' + sas_formatid + '/'+sas_master + '/' + sas_tmstp + '/' + escape(sas_target) + '?"></SCR'+'IPT>');
}

function expand(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);

  td.className = "menuHover";
  d.className = "menuHover";
}
function collapse(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);

  td.className = "menuNormal";
  d.className = "menuNormal";
}
function openWindowOnClick(url)
{

    var x = window.open(url,'','height=400,width=600');
    x.focus();
}
function openWindow(url)
{

    var x = window.open(url);
    x.focus();
}
var menu1=new Array()
menu1[0]='<a href="ind.php?ind_id=2&l=a" title="Click to view Environmental Products">Environmental</a>'
menu1[1]='<a href="ind.php?ind_id=3&l=a" title="Click to view Petrochemical Products">Petrochemical</a>'
menu1[2]='<a href="ind.php?ind_id=1&l=a" title="Click to view Laboratory Products">Laboratory</a>'
var menuwidth='100px'
var menubgcolor='#71BF44'

var disappeardelay=250
var hidemenu_onclick="yes"

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></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, menuwidth){
    if (ie4||ns6)
        dropmenuobj.style.left=dropmenuobj.style.top=-500
    if (menuwidth!=""){
        dropmenuobj.widthobj=dropmenuobj.style
        dropmenuobj.widthobj.width=menuwidth
    }
    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=0
    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 topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
        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){ //move up?
            edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
        if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
            edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
        }
    }
    return edgeoffset
}

function populatemenu(what){
    if (ie4||ns6)
    dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
    if (window.event) event.cancelBubble=true
    else if (e.stopPropagation) e.stopPropagation()
        clearhidemenu()
    dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
    populatemenu(menucontents)

    if (ie4||ns6){
        showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
    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"
}

return clickreturnvalue()
}

function clickreturnvalue(){
    if (ie4||ns6)
        return false
    else
        return true
}

function contains_ns6(a, b) {
    while (b.parentNode)
        if ((b = b.parentNode) == a)
            return true;
    return false;
}

function dynamichide(e){
    if (ie4&&!dropmenuobj.contains(e.toElement))
        delayhidemenu()
    else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
       delayhidemenu()
}

function hidemenu(e){
    if (typeof dropmenuobj!="undefined"){
        if (ie4||ns6)
            dropmenuobj.style.visibility="hidden"
    }
}

function delayhidemenu(){
    if (ie4||ns6)
        delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
    if (typeof delayhide!="undefined")
        clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
    document.onclick=hidemenu


function emailCheck (emailStr) {

    /* The following variable tells the rest of the function whether or not
    to verify that the address ends in a two-letter country or well-known
    TLD.  1 means check it, 0 means don't. */

    var checkTLD=1;

    /* The following is the list of known TLDs that an e-mail address must end with. */

    var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

    /* The following pattern is used to check if the entered e-mail address
    fits the user@domain format.  It also is used to separate the username
    from the domain. */

    var emailPat=/^(.+)@(.+)$/;

    /* The following string represents the pattern for matching all special
    characters.  We don't want to allow special characters in the address.
    These characters include ( ) < > @ , ; : \ " . [ ] */

    var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

    /* The following string represents the range of characters allowed in a
    username or domainname.  It really states which chars aren't allowed.*/

    var validChars="\[^\\s" + specialChars + "\]";

    /* The following pattern applies if the "user" is a quoted string (in
    which case, there are no rules about which characters are allowed
    and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
    is a legal e-mail address. */

    var quotedUser="(\"[^\"]*\")";

    /* The following pattern applies for domains that are IP addresses,
    rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
    e-mail address. NOTE: The square brackets are required. */

    var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

    /* The following string represents an atom (basically a series of non-special characters.) */

    var atom=validChars + '+';

    /* The following string represents one word in the typical username.
    For example, in john.doe@somewhere.com, john and doe are words.
    Basically, a word is either an atom or quoted string. */

    var word="(" + atom + "|" + quotedUser + ")";

    // The following pattern describes the structure of the user

    var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

    /* The following pattern describes the structure of a normal symbolic
    domain, as opposed to ipDomainPat, shown above. */

    var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

    /* Finally, let's start trying to figure out if the supplied address is valid. */

    /* Begin with the coarse pattern to simply break up user@domain into
    different pieces that are easy to analyze. */

    var matchArray=emailStr.match(emailPat);

    if (matchArray==null) {

    /* Too many/few @'s or something; basically, this address doesn't
    even fit the general mould of a valid e-mail address. */

    alert("Email address seems incorrect (check @ and .'s)");
    return false;
    }
    var user=matchArray[1];
    var domain=matchArray[2];

    // Start by checking that only basic ASCII characters are in the strings (0-127).

    for (i=0; i<user.length; i++) {
    if (user.charCodeAt(i)>127) {
    alert("Ths username contains invalid characters in the email address.");
    return false;
       }
    }
    for (i=0; i<domain.length; i++) {
    if (domain.charCodeAt(i)>127) {
    alert("Ths domain name contains invalid characters in the email address.");
    return false;
       }
    }

    // See if "user" is valid

    if (user.match(userPat)==null) {

    // user is not valid

    alert("The username doesn't seem to be valid in the email address.");
    return false;
    }

    /* if the e-mail address is at an IP address (as opposed to a symbolic
    host name) make sure the IP address is valid. */

    var IPArray=domain.match(ipDomainPat);
    if (IPArray!=null) {

    // this is an IP address

    for (var i=1;i<=4;i++) {
    if (IPArray[i]>255) {
    alert("Destination IP address is invalid!");
    return false;
       }
    }
    return true;
    }

    // Domain is symbolic name.  Check if it's valid.

    var atomPat=new RegExp("^" + atom + "$");
    var domArr=domain.split(".");
    var len=domArr.length;
    for (i=0;i<len;i++) {
    if (domArr[i].search(atomPat)==-1) {
    alert("The domain name does not seem to be valid in the email address.");
    return false;
       }
    }

    /* domain name seems valid, but now make sure that it ends in a
    known top-level domain (like com, edu, gov) or a two-letter word,
    representing country (uk, nl), and that there's a hostname preceding
    the domain or country. */

    if (checkTLD && domArr[domArr.length-1].length!=2 &&
    domArr[domArr.length-1].search(knownDomsPat)==-1) {
    alert("The email address must end in a well-known domain or two letter " + "country.");
    return false;
    }

    // Make sure there's a host name preceding the domain.

    if (len<2) {
    alert("This email address is missing a hostname!");
    return false;
    }

    // If we've gotten this far, everything's valid!
    return true;
}
/*
This function changes the link and front cover picture of the jounral on journals.php
*/

function JournalSelectChanged(selec){
  if (selec.name == 'IETSELECTBOX'){
    if(selec.value==1){
        document.getElementById('IETLINK').href="./journals/IET_SEP_06.pdf";
        document.getElementById('IETLINK').title="IET September 2006";
        document.getElementById('IETIMGLINK').href="./journals/IET_SEP_06.pdf";
        document.getElementById('IETIMGLINK').title="IET September 2006";
        
        document.images['IETIMG'].src="./images/OFC_IET_SEP_06.jpg";
        document.images['IETIMG'].alt="International Environmental Technology September 2006, Volume 16 Issue 5"
    }
    else if(selec.value==2){
        document.getElementById('IETLINK').href="./journals/IET_NOV_06.pdf";
        document.getElementById('IETLINK').title="IET November 2006";
        document.getElementById('IETIMGLINK').href="./journals/IET_NOV_06.pdf";
        document.getElementById('IETIMGLINK').title="IET November 2006";

        
        document.images['IETIMG'].src="./images/OFC_IET_NOV_06.jpg";
        document.images['IETIMG'].alt="International Environmental Technology November 2006, Volume 16 Issue 6"
    }
	else if(selec.value==3){
        document.getElementById('IETLINK').href="./journals/IET_MAR_07.pdf";
        document.getElementById('IETLINK').title="IET March 2007";
        document.getElementById('IETIMGLINK').href="./journals/IET_MAR_07.pdf";
        document.getElementById('IETIMGLINK').title="IET March 2007";

        
        document.images['IETIMG'].src="./images/OFC_IET_MAR_07.jpg";
        document.images['IETIMG'].alt="International Environmental Technology March 2007, Volume 17 Issue 2"
    }
	else if(selec.value==4){
        document.getElementById('IETLINK').href="./journals/IET_MAY_07.pdf";
        document.getElementById('IETLINK').title="IET May 2007";
        document.getElementById('IETIMGLINK').href="./journals/IET_MAY_07.pdf";
        document.getElementById('IETIMGLINK').title="IET May 2007";

        
        document.images['IETIMG'].src="./images/OFC_IET_MAY_07.jpg";
        document.images['IETIMG'].alt="International Environmental Technology May 2007, Volume 17 Issue 3"
    }
    else if(selec.value==5){
        document.getElementById('IETLINK').href="./journals/IET_SEPT_07.pdf";
        document.getElementById('IETLINK').title="IET September 2007";
        document.getElementById('IETIMGLINK').href="./journals/IET_SEPT_07.pdf";
        document.getElementById('IETIMGLINK').title="IET September 2007";

        
        document.images['IETIMG'].src="./images/OFC_IET_SEPT_07.jpg";
        document.images['IETIMG'].alt="International Environmental Technology September 2007, Volume 17 Issue 5"
    }
	 else if(selec.value==6){
        document.getElementById('IETLINK').href="./journals/IET_NOV_07.pdf";
        document.getElementById('IETLINK').title="IET November 2007";
        document.getElementById('IETIMGLINK').href="./journals/IET_NOV_07.pdf";
        document.getElementById('IETIMGLINK').title="IET November 2007";

        
        document.images['IETIMG'].src="./images/OFC_IET_NOV_07.jpg";
        document.images['IETIMG'].alt="International Environmental Technology November 2007, Volume 17 Issue 6"
    }
  }
  else if (selec.name == 'PINSELECTBOX'){
    if(selec.value==1){
        document.getElementById('PINLINK').href="./journals/PIN_AUG_06.pdf";
        document.getElementById('PINLINK').title="PIN August 2006";
        document.getElementById('PINIMGLINK').href="./journals/PIN_AUG_06.pdf";
        document.getElementById('PINIMGLINK').title="PIN August 2006";
        
        document.images['PINIMG'].src="./images/OFC_PIN_AUG_06.jpg";
        document.images['PINIMG'].alt="Petro Indusrty News August 2006, Volume 7 Issue 4"
    }
    else if(selec.value==2){
        document.getElementById('PINLINK').href="./journals/PIN_NOV_06.pdf";
        document.getElementById('PINLINK').title="PIN November 2006";
        document.getElementById('PINIMGLINK').href="./journals/PIN_NOV_06.pdf";
        document.getElementById('PINIMGLINK').title="PIN November 2006";

        document.images['PINIMG'].src="./images/OFC_PIN_NOV_06.jpg";
        document.images['PINIMG'].alt="Petro Indusrty News November 2006, Volume 7 Issue 5"
    }
    else if(selec.value==3){
        document.getElementById('PINLINK').href="./journals/PIN_FEB_07.pdf";
        document.getElementById('PINLINK').title="PIN February 2007";
        document.getElementById('PINIMGLINK').href="./journals/PIN_Feb_07.pdf";
        document.getElementById('PINIMGLINK').title="PIN February 2007";

        document.images['PINIMG'].src="./images/OFC_PIN_FEB_07.jpg";
        document.images['PINIMG'].alt="Petro Indusrty News February 2007, Volume 8 Issue 1"
    }
	else if(selec.value==4){
        document.getElementById('PINLINK').href="./journals/PIN_JUNE_07.pdf";
        document.getElementById('PINLINK').title="PIN June 2007";
        document.getElementById('PINIMGLINK').href="./journals/PIN_JUNE_07.pdf";
        document.getElementById('PINIMGLINK').title="PIN June 2007";

        document.images['PINIMG'].src="./images/OFC_PIN_JUNE_07.jpg";
        document.images['PINIMG'].alt="Petro Indusrty News June 2007, Volume 8 Issue 3"
    }
    else if(selec.value==5){
        document.getElementById('PINLINK').href="./journals/PIN_AUG_07.pdf";
        document.getElementById('PINLINK').title="PIN August 2007";
        document.getElementById('PINIMGLINK').href="./journals/PIN_AUG_07.pdf";
        document.getElementById('PINIMGLINK').title="PIN August 2007";

        document.images['PINIMG'].src="./images/OFC_PIN_AUG_07.jpg";
        document.images['PINIMG'].alt="Petro Indusrty News August 2007, Volume 8 Issue 4"
    }
    else if(selec.value==6){
        document.getElementById('PINLINK').href="./journals/PIN_OCT_07.pdf";
        document.getElementById('PINLINK').title="PIN October 2007";
        document.getElementById('PINIMGLINK').href="./journals/PIN_OCT_07.pdf";
        document.getElementById('PINIMGLINK').title="PIN October 2007";

        document.images['PINIMG'].src="./images/OFC_PIN_OCT_07.jpg";
        document.images['PINIMG'].alt="Petro Indusrty News October 2007, Volume 8 Issue 5"
    }
  }
}

