function MM_reloadPage(init) {  //reloads the window if Nav4 resized

  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {

    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_rloadPage; }}

  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();

}

MM_reloadPage(true);



function MM_jumpMenu(targ,selObj,restore){ //v3.0

  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;

}



var image1_open =new Image();

var image1_close =new Image();

image1_open.src ="templates/images/arrow_open.gif"

image1_close.src ="templates/images/arrow_close.gif"

var scrollBackTo;



function showMore(obj_id, objhead_id, objhead_open, objhead_close, objimg_id, objimg_open, objimg_close) {

    scrollBackTo = window.document.body.scrollTop;

    if (window.document.getElementById(obj_id).style.display != 'none'){

        if (objimg_id.length > 0){

            window.document.getElementById(objimg_id).src=objimg_close;

		}

        if (objhead_id.length > 0){

            window.document.getElementById(objhead_id).className=objhead_close;

        }

        window.document.getElementById(obj_id).style.display='none';

    }else{

        if (objimg_id.length > 0){

            window.document.getElementById(objimg_id).src=objimg_open;

        }

        if (objhead_id.length > 0){

            window.document.getElementById(objhead_id).className=objhead_open;

        }

      //  window.document.getElementById(obj_id).style.display='block';
	   //Added by Vaishali Choudhary
	   window.document.getElementById(obj_id).style.display='';

        

    }

    setTimeout('window.scrollTo(0, scrollBackTo);', 100);

}



var allCats = new Array();



function showAll(openall,totalCat) {

    for (var i = 0; i < totalCat; i++){

        if (openall == 1){

            if (window.document.getElementById(('compbody'+i)).style.display == 'none'){

                showMore(('compbody'+i), '', '', '',('compimg'+i),  image1_open.src, image1_close.src) 

				  document.getElementById('text_cat_'+i).innerText = 'Hide products';

//                window.document.getElementById('text_cat_'+('compbody'+i)).innerText = 'Hide products'

            }

        }else{

            if (window.document.getElementById(('compbody'+i)).style.display != 'none'){

                showMore(('compbody'+i), '', '', '', ('compimg'+i),  image1_open.src, image1_close.src) 

				  document.getElementById('text_cat_'+i).innerText = 'Show products';				

//                window.document.getElementById('text_cat_'+('compbody'+i)).innerText = 'Show products'

            }

        }

    }

}

function hideAll(openall,totalCat) {

    for (var i = 0; i < totalCat; i++){

        if (openall == 1){

            if (window.document.getElementById(('compbody'+i)).style.display == 'block'){

                showMore(('compbody'+i), '', '', '',('compimg'+i),  image1_open.src, image1_close.src) 

				  document.getElementById('text_cat_'+i).innerText = 'Hide Products';

//                window.document.getElementById('text_cat_'+('compbody'+i)).innerText = 'Hide products'

            }

        }

    }

}

function MHC1show(catid){
    if (document.getElementById('text_cat_' + catid).innerText == 'Hide products'){
        document.getElementById('text_cat_' + catid).innerText = 'Show products'
		// #!# This is added for FIREFOX AND OTHER BROWSER
		document.getElementById('text_cat_' + catid).innerHTML = 'Show products'
    }else{
        document.getElementById('text_cat_' + catid).innerText = 'Hide products'
		// #!# This is added for FIREFOX AND OTHER BROWSER
		document.getElementById('text_cat_' + catid).innerHTML = 'Hide products'
    }
//    showMore('cat_' + catid, '', '', '', 'catimg' + catid, image1_open.src, image1_close.src);
}



function MHC2chk(srcCheckbox, partnerTextbox){
 if (srcCheckbox.checked){

  document.getElementById(partnerTextbox).style.visibility = 'visible';

  document.getElementById(partnerTextbox).value='1';

 }else{

  document.getElementById(partnerTextbox).style.visibility = 'hidden';

  document.getElementById(partnerTextbox).value='0';

 }

}

function verifyPepSeq(srcPep){

    if (navigator.appName == 'Netscape') {

        if ((window.event.which > 96) && (window.event.which < 123)){

            window.event.which = window.event.which - 32

        }

        if ((window.event.which < 65) || (window.event.which > 90) || (window.event.which == 66) || (window.event.which == 74) || (window.event.which == 79) || (window.event.which == 85) || (window.event.which == 88) || (window.event.which == 90)){

            return false

        }

    }else{

        if ((window.event.keyCode > 96) && (window.event.keyCode < 123)){

            window.event.keyCode = window.event.keyCode - 32

        }

        if ((window.event.keyCode < 65) || (window.event.keyCode > 90) || (window.event.keyCode == 66) || (window.event.keyCode == 74) || (window.event.keyCode == 79) || (window.event.keyCode == 85) || (window.event.keyCode == 88) || (window.event.keyCode == 90)){

            window.event.cancelBubble = true;

            window.event.returnValue = false;

            return false

        }

    }

}



var defaultCurr = 'GBP';



var priceGBPcrude = 17.5;

var priceGBPrefined = 19.9;

var priceGBPrefinedHigh = 19.9;

var priceGBPrefinedHighAdd = 220;



var priceUSDcrude = 27.9;

var priceUSDrefined = 31.9;

var priceUSDrefinedHigh = 31.9;

var priceUSDrefinedHighAdd = 330;



var priceEURcrude = 27.9;

var priceEURrefined = 31.9;

var priceEURrefinedHigh = 31.9;

var priceEURrefinedHighAdd = 330;



function updateCusPepPrice(srcForm, srcPepNum, currLetter){

    if ((srcForm.elements['partno' + srcPepNum].checked) && (srcForm.elements['custPepSeq' + srcPepNum].value != '') && (srcForm.elements['quantity' + srcPepNum].value != '')){

        var currentPurity = srcForm.elements['custPepPurity' + srcPepNum].selectedIndex;

        var currentPrice = 0;

        var pepLength = srcForm.elements['custPepSeq' + srcPepNum].value.length;

        if (pepLength < 10){

            pepLength = 10

        }

        if (currentPurity == 2) {

            currentPrice = Math.round(((pepLength * eval('price' + defaultCurr + 'refinedHigh')) + eval('price' + defaultCurr + 'refinedHighAdd')) * srcForm.elements['quantity' + srcPepNum].value*100)/100

        }else{

            if (currentPurity == 1) {

                currentPrice = Math.round((pepLength * eval('price' + defaultCurr + 'refined')) * srcForm.elements['quantity' + srcPepNum].value*100)/100;

            }else{

                currentPrice = Math.round((pepLength * eval('price' + defaultCurr + 'crude')) * srcForm.elements['quantity' + srcPepNum].value*100)/100;

            }

        }

        currentPrice = currentPrice + ""

        if (currentPrice.indexOf(".") == -1){

            currentPrice = currentPrice + ".00"

        } else {

            currentPrice = currentPrice + "00"

        }

        currentPrice = currentPrice.substring(0, currentPrice.indexOf(".")+3)

        srcForm.elements['dispPrice' + srcPepNum].value = currentPrice;

        srcForm.elements['price' + srcPepNum].value = currentPrice/srcForm.elements['quantity' + srcPepNum].value;



        if (srcForm.elements['custPepPurity' + srcPepNum].selectedIndex == 2){

            srcForm.elements['custPepScale' + srcPepNum].value = '10mg';

            srcForm.elements['partno' + srcPepNum].value = 'P0E-' + currLetter + ' - ' + srcForm.elements['custPepSeq' + srcPepNum].value + ' - 10mg';

        }else{

            srcForm.elements['custPepScale' + srcPepNum].value = '20mg';

            if (srcForm.elements['custPepPurity' + srcPepNum].selectedIndex == 1){

                srcForm.elements['partno' + srcPepNum].value = 'P0D-' + currLetter + ' - ' + srcForm.elements['custPepSeq' + srcPepNum].value + ' - 20mg';

            }else{

                srcForm.elements['partno' + srcPepNum].value = 'P0C-' + currLetter + ' - ' + srcForm.elements['custPepSeq' + srcPepNum].value + ' - 20mg';

            }

        }

    }

}



function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_validateForm() { //v4.0

  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments,focuson=0;

  for (i=0; i<(args.length-2); i+=3) {

    test=args[i+2];

    val=MM_findObj(args[i]);

    if (val) {

      nm=val.name;

      if ((val=val.value)!="") {

        if (test.indexOf('isEmail')!=-1) {

          p=val.indexOf('@');

          if (p<1 || p==(val.length-1)) {

            errors+='- '+nm+' must contain an e-mail address.\n';

            if (focuson==0) focuson=val;

          }

        } else if (test!='R') {

          num = parseFloat(val);

          if (isNaN(val)) {

            errors+='- '+nm+' must contain a number.\n';

            if (focuson==0) focuson=val;

          }

          if (test.indexOf('inRange') != -1) {

            p=test.indexOf(':');

            min=test.substring(8,p);

            max=test.substring(p+1);

            if (num<min || max<num) {

              errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';

              if (focuson==0) focuson=val;

            }

          }

        } 

      } else if (test.charAt(0) == 'R') {

        errors += '- '+nm+' is required.\n'; 

        if (focuson==0) focuson=val;

      }

    }

  }

  if (errors) {

    alert('The following information is required :\n'+errors);

    focuson.focus();

    return false;

  }else{

    return true;

  }

}

