var link=new Array()
function showpp(el_id)
{
	if (document.getElementById(el_id).style.display=="")
	{
	document.getElementById(el_id).style.display="none";
	}
	else
	{
	document.getElementById(el_id).style.display=""
	}	
}
var delay_hide=500
var menuobj;
var menu;
var default_menu_item;


function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck();

function showHideLayer (obj,visible)
{	this.evnt=bw.dom? 	document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;

	if(!this.evnt) return false
	this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;	
   	this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;	
	this.css.visibility = visible;
	this.css.width='100%';

}

function XVi(obj,visible){								
   	this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;

	if(!this.evnt) return false
	this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;	
   	this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;	
	this.css.visibility = visible;
	this.css.top='94px';
	bw.ns4||bw.ns6?this.css.left='-8px':
	this.css.left='0px';
	this.css.width='100%';
	this.css.position="absolute";
}


function writeSubmenu(obj,item){								
   	this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
	if(!this.evnt) return false
	this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;	
   	this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;	
	thecontent=(item==-1)? "" : link[item]
	this.wref.innerHTML=thecontent;

}


function clearContent(obj){	
						
   	this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
	if(!this.evnt) return false
	this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;	
   	this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;	
	thecontent=(item==-1)? "" : link[item]
	this.wref.innerHTML="";

}


function clear_delayhide()
{
	//alert("asdASD");
	if (window.delayhide)
	{onlpgld(default_menu_item)
	clearTimeout(delayhide)
}
}

function contains_ns6(a, b) 
{
	while (b.parentNode)
	if ((b = b.parentNode) == a)
		return true;
	return false;
}




function setCSS(typ)
{ 
	var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) 
	{

	    if(a.getAttribute("rel").indexOf("style") != -1 && 	a.getAttribute("title")) {
      	    a.disabled = true;
            if(a.getAttribute("title") == typ) a.disabled = false;
    }
  }
	
}



function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}


function openWin(pg)
{

if (pg.indexOf('special') >= 0 )
{
var attributes = 'toolbar=0,location=0,directories=0,status=0, menubar=0,scrollbars=1,resizable=1,width=800,height=800,left=0,top=0';
}
else
{
var attributes = 'toolbar=0,location=0,directories=0,status=0, menubar=0,scrollbars=1,resizable=1,width=600,height=800,left=0,top=0';
}

sealWin=window.open(pg ,'',attributes); 
self.name = pg; 
}

function valfld(field)
{

	var valid = "0123456789."; // these are allowed values
	var ok = "yes";
	var temp;
	if (field.value.length == 0 )
	{
		//alert("Invalid entry! please enter number");
		field.value = ""
		field.focus();
		field.select();
		return false;	
	}
	for (var i=0; i<field.value.length; i++)
	{
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") 
		ok = "no";
	}
	if (ok == "no") 
	{
		alert("Invalid entry! Only numbers are allowed!");
		field.value = ""
		field.focus();
		field.select();

		return false;
	}
	else
		return true;
	}


function chkvldemail(email_address)
   {
         //Assumes that valid email addresses consist of user_name@domain.tld
         at = email_address.indexOf('@');
         dot = email_address.indexOf('.');
         
         if(at == -1 || 
            dot == -1 ||         
            dot == 0 )
		{	
			alert("Please enter valid email address 1.");
            return(false);
		}
            
         user_name = email_address.substr(0, at);
         domain_name = email_address.substr(at + 1, email_address.length);                  

         if(Validate_String(user_name) == false || Validate_String(domain_name) == false)
		{	
			alert("Please enter valid email address.");
	            return(false); 
                }
         else
		 return(true);
}

function Validate_String(string, return_invalid_chars)
         {
         valid_chars = '1234567890-_.^~abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
         invalid_chars = '';
         
         if(string == null || string == '')
            return(true);
         
         //For every character on the string.   
         for(index = 0; index < string.length; index++)
            {
            charx = string.substr(index, 1);                        
            
            //Is it a valid character?
            if(valid_chars.indexOf(charx) == -1)
              {
              //If not, is it already on the list of invalid characters?
              if(invalid_chars.indexOf(charx) == -1)
                {
                //If it's not, add it.
                if(invalid_chars == '')
                   invalid_chars += charx;
                else
                   invalid_chars += ', ' + charx;
                }
              }
            }                     
            
         //If the string does not contain invalid characters, the function will return true.
         //If it does, it will either return false or a list of the invalid characters used
         //in the string, depending on the value of the second parameter.
         if(return_invalid_chars == true && invalid_chars != '')
           {
           last_comma = invalid_chars.lastIndexOf(',');
           
           if(last_comma != -1)
              invalid_chars = invalid_chars.substr(0, $last_comma) + 
              ' and ' + invalid_chars.substr(last_comma + 1, invalid_chars.length);
                      
           return(invalid_chars);
           }
         else
           return(invalid_chars == ''); 
         }

function trimstr(par)
{

while (par.charAt(0)==" "){
par=par.replace(" ","")
}
i=par.length-1
while(par.charAt(i)==" "){
par=par.slice(0,i)
i=i-1
}
return par
}

// var xyz = createBar(
// total_width,
// total_height,
// background_color,
// border_width,
// border_color,
// block_color,
// scroll_speed,
// block_count,
// scroll_count,
// action_to_perform_after_scrolled_n_times
// )

var w3c=(document.getElementById)?true:false;
var ie=(document.all)?true:false;
var N=-1;
var back_color='white';
var bar_color='green';
function createBar(w,h,bgc,brdW,brdC,blkC,speed,blocks,count,action,flag){
if(ie||w3c){

	bgc=back_color;
	blkC=bar_color;

if (flag!=''){
	h=13;
	}
h=10
var t='<div id="_xpbar'+(++N)+'" style="visibility:visible; position:relative; overflow:hidden; width:'+w+'px; height:'+h+'px; background-color:'+bgc+'; border-color:'+brdC+'; border-width:'+brdW+'px; border-style:solid; font-size:1px;">';
t+='<span id="blocks'+N+'" style="left:-'+(h*2+1)+'px; position:absolute; font-size:1px">';
for(i=0;i<blocks;i++){
t+='<span style="background-color:'+blkC+'; left:-'+((h*i)+i)+'px; font-size:1px; position:absolute; width:'+h+'px; height:'+h+'px; '
t+=(ie)?'filter:alpha(opacity='+(100-i*(100/blocks))+')':'-Moz-opacity:'+((100-i*(100/blocks))/100);
t+='"></span>';
}
t+='</span></div>';
document.write(t);
var bA=(ie)?document.all['blocks'+N]:document.getElementById('blocks'+N);
bA.bar=(ie)?document.all['_xpbar'+N]:document.getElementById('_xpbar'+N);
bA.blocks=blocks;
bA.N=N;
bA.w=w;
bA.h=h;
bA.speed=speed;
bA.ctr=0;
bA.count=count;
bA.action=action;
bA.togglePause=togglePause;
bA.showBar=function(){
this.bar.style.visibility="visible";
}
bA.hideBar=function(){
this.bar.style.visibility="hidden";
}
bA.tid=setInterval('startBar('+N+')',speed);
return bA;
}}

function startBar(bn){
var t=(ie)?document.all['blocks'+bn]:document.getElementById('blocks'+bn);
if(parseInt(t.style.left)+t.h+1-(t.blocks*t.h+t.blocks)>t.w){
t.style.left=-(t.h*2+1)+'px';
t.ctr++;
if(t.ctr>=t.count){
eval(t.action);
t.ctr=0;
}}else t.style.left=(parseInt(t.style.left)+t.h+1)+'px';
}

function togglePause(){
if(this.tid==0){
this.tid=setInterval('startBar('+this.N+')',this.speed);
}else{
clearInterval(this.tid);
this.tid=0;
}}

function togglePause(){
if(this.tid==0){
this.tid=setInterval('startBar('+this.N+')',this.speed);
}else{
clearInterval(this.tid);
this.tid=0;
}}

var enableCache = false;
var jsCache = new Array();
var AjaxObjects = new Array();

function ShowContent(divId,ajaxIndex,url)
{
	document.getElementById(divId).innerHTML = AjaxObjects[ajaxIndex].response;
	if(enableCache){
		jsCache[url] = 	AjaxObjects[ajaxIndex].response;
	}
	AjaxObjects[ajaxIndex] = false;
}

function Ajax(divId,url)
{
	if(enableCache && jsCache[url]){
		document.getElementById(divId).innerHTML = jsCache[url];
		return;
	}	
	var ajaxIndex = AjaxObjects.length;
	AjaxObjects[ajaxIndex] = new sack();
	AjaxObjects[ajaxIndex].requestFile = url;
	document.getElementById(divId).innerHTML = "<img src='images/loading.gif'>";
	AjaxObjects[ajaxIndex].onCompletion = function(){ ShowContent(divId,ajaxIndex,url);return true; };
	AjaxObjects[ajaxIndex].onError = function(){ ShowError('S',divId,ajaxIndex,url);return false; };
	AjaxObjects[ajaxIndex].onFail = function(){ ShowError('C',divId,ajaxIndex,url);return false; };
	
	AjaxObjects[ajaxIndex].runAJAX();
}

function fetchEntry(url)
{
	if(enableCache && jsCache[url]){
		document.getElementById(divId).innerHTML = jsCache[url];
		return;
	}	
	var ajaxIndex = AjaxObjects.length;
	AjaxObjects[ajaxIndex] = new sack();
	AjaxObjects[ajaxIndex].requestFile = url;
	AjaxObjects[ajaxIndex].onCompletion = function(){ ShowEntry(ajaxIndex,url); };

	AjaxObjects[ajaxIndex].runAJAX();
}

function ShowEntry(ajaxIndex,url)
{
	var res_text = AjaxObjects[ajaxIndex].response;
	if(enableCache){
		jsCache[url] = 	AjaxObjects[ajaxIndex].response;
	}
	AjaxObjects[ajaxIndex] = false;

}
function ShowError(typ,divId,ajaxIndex,url)
{
	//alert(AjaxObjects[ajaxIndex].response);
	if (typ=='S')
		{document.getElementById(divId).innerHTML = AjaxObjects[ajaxIndex].response;}
	else
		{document.getElementById(divId).innerHTML = "<font face='arial' color='#ff0000'><b>Error!</b> There was an communication error.</font>";}

	if(enableCache){
		jsCache[url] = 	AjaxObjects[ajaxIndex].response;
	}
	AjaxObjects[ajaxIndex] = false;	
}
/*
function InvMenu(Iid)
	{
		//alert(document.getElementById(Iid).style.visibility);
	if (document.getElementById(Iid).style.visibility=='visible')
		{
		document.getElementById(Iid).style.visibility='hidden';
		document.getElementById(Iid).innerHTML='';
		}
	else
		{
		document.getElementById(Iid).style.visibility='visible';
		Ajax(Iid,'inv_menu.asp');
		}
	}


function ImportMenu(Iid)
	{
	if (document.getElementById(Iid).style.visibility=='visible')
		{
		document.getElementById(Iid).style.visibility='hidden';
		document.getElementById(Iid).innerHTML='';
		}
	else
		{
		document.getElementById(Iid).style.visibility='visible';
		Ajax(Iid,'import_menu.asp');
		}
	}
*/
function tMenu(lid, ty,lbl)
{
	document.getElementById(lid).style.display='';
	document.getElementById(lid).innerHTML='';
	document.getElementById('stk').className='';
	document.getElementById('iv').className='';
	document.getElementById('admn').className='';
	document.getElementById('rpt').className='';
	if (document.getElementById('imp')!=null)
	{document.getElementById('imp').className='';
	}
	document.getElementById(lbl).display="";
	//document.getElementById(lbl).className='bc';

	 if (ty=='inv')
	{	Ajax(lid,'inv_menu.asp');}
	else if (ty=='import')
	{Ajax(lid,'import_menu.asp');}
	else if (ty=='stock')
	{	Ajax(lid,'stocks_menu.asp');}
	 else if (ty=='report')
	{	Ajax(lid,'report_menu.asp');}
	else if (ty=='admin')
	{	Ajax(lid,'admin_menu.asp');} 
	ShowContentEx(lid)
}

	function ShowContentEx(d) 
{

	var dd = document.getElementById(d);
	AssignPosition(dd);
	dd.style.display = "block";
}

function hmenu(mnu)
{
//document.getElementById(mnu).style.visibility='hidden';

		document.getElementById(mnu).innerHTML='';
		document.getElementById(mnu).style.display='none';
		document.getElementById('stk').className='';
	document.getElementById('iv').className='';
	if (document.getElementById('imp')!=null)
	{document.getElementById('imp').className='';
	}
	document.getElementById('rpt').className='';
	document.getElementById('admn').className='';
}
function InvMenu(Iid)
{
	
	if (document.getElementById(Iid).style.visibility=='visible')
		{
		document.getElementById(Iid).style.visibility='hidden';
		document.getElementById(Iid).innerHTML='';
		}
	else
		{
		document.getElementById(Iid).style.visibility='visible';
		Ajax(Iid,'inv_menu.asp');
		}
}


function ImportMenu(Iid)
{
	if (document.getElementById(Iid).style.visibility=='visible')
		{
		document.getElementById(Iid).style.visibility='hidden';
		document.getElementById(Iid).innerHTML='';
		}
	else
		{
		document.getElementById(Iid).style.visibility='visible';
		Ajax(Iid,'import_menu.asp');
		}
}

function StocksMenu(Iid)
{
	if (document.getElementById(Iid).style.visibility=='visible')
		{
		document.getElementById(Iid).style.visibility='hidden';
		document.getElementById(Iid).innerHTML='';
		}
	else
		{
		document.getElementById(Iid).style.visibility='visible';
		Ajax(Iid,'stocks_menu.asp');
		}
}

function cj(tv)
{
	document.getElementById('sjn').innerHTML='Please wait changing journal to=> ' + tv;
	window.location.href='changejournal.asp?j_name='+tv;

}

function fj()
{
	Iid='sj';	
	if (document.getElementById(Iid).style.visibility=='visible')
		{
		document.getElementById(Iid).style.visibility='hidden';
		document.getElementById(Iid).innerHTML='';
		}
	else
		{
		document.getElementById(Iid).style.visibility='visible';
		Ajax(Iid,'sj.asp');
		}
}

function hidesj()
{
	Iid='sj';
document.getElementById(Iid).style.visibility='hidden';
		document.getElementById(Iid).innerHTML='';
}


function updawb(id)
{
	//alert('asdf');
	//var Confirm_Update = confirm('Do you really want to update AWB number?');
	//if (Confirm_Update==true)
	//{
		did='a' + id;
		Ajax(did,'updateawb.asp?id='+id);
	//}

}

function setawb(did, tv)
{
	var lid='a'+did;

Ajax(lid,'setawb.asp?awb='+tv +'&id='+did);	

}


var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }

function AssignPosition(d) {
if(self.pageYOffset) {
	rX = self.pageXOffset;
	rY = self.pageYOffset;
	}
else if(document.documentElement && document.documentElement.scrollTop) {
	rX = document.documentElement.scrollLeft;
	rY = document.documentElement.scrollTop;
	}
else if(document.body) {
	rX = document.body.scrollLeft;
	rY = document.body.scrollTop;
	}
if(document.all) {
	cX += rX; 
	cY += rY;
	}
d.style.left = (cX) + "px";
d.style.top = (cY+5) + "px";

}

//document.write('<script type="text/javascript" src="includes/menu.js"><\/script>')






//Sub-menu for Administration menu
var menu1=new Array()
menu1[0]='<a href="journaladministration.asp">Journal Administration</a>'
menu1[1]='<a href="useradministration.asp">User Administration</a>'
menu1[2]='<a href="n_agency_jrnl.asp">Journals Biblio listings</a>'
menu1[3]='<a href="journaldeloptions.asp">Edit Delivery Options</a>'
menu1[4]='<a href="calculatecopies.asp">Calculate Copies</a>'
menu1[5]='<a href="journal_access.asp">PDF Policy</a>'
menu1[6]='<a href="journal_ip.asp">PDF IP Based Policy</a>'
menu1[7]='<a href="setad.asp">Set Advertisement for journals</a>'
menu1[8]='<a href="view_advt_details.asp">View Advertisement Details</a>'
menu1[9]='<a href="promotional_code.asp">Promotional Code</a>'
menu1[10]='<a href="txnpage.asp">Create PDF paypal invoices</a>'

//Sub-menu for Reports menu
var menu2=new Array()
menu2[0]='<a href="Rpt_UpdateRequests.asp?ua=true">Add. Change Approvals</a>'
menu2[1]='<a href="issuesadded.asp">View Issues Added</a>'
menu2[2]='<a href="RptPaidusers.asp">Online Users Report</a>'
menu2[3]='<a href="CheckService.asp">Check Courier Service</a>'
menu2[4]='<a href="SubscriptionsSummary.asp">Editor Reports</a>'
menu2[5]='<a href="SubscriptionsSummary_Agent.asp">Agent Reports</a>'
menu2[6]='<a href="journalsummary.asp">Journal Summary</a>'
menu2[7]='<a href="invreport.asp">Invoice Report</a>'
menu2[8]='<a href="returnreport.asp">Return Report</a>'
menu2[9]='<a href="RptImportInfo.asp?s=d">Import Information</a>'
menu2[10]='<a href="CheckStatus.asp">Check AWB Status</a>'
menu2[11]='<a href="createlabels.asp">Create Invoice Labels</a>'
menu2[12]='<a href="pdfaccessreport.asp">PDF Access Reports</a>'
menu2[13]='<a href="promotional_code_access_report.asp">Promotional code Access Reports</a>'
menu2[14]='<a href="claim_report.asp">Claim Reply Reports</a>'
menu2[15]='<a href="claim_mem_report.asp">Members claim Reply Reports</a>'


menu2[16]='<a href="rpt_gen_invoice.asp">Postage charge invoice Reports</a>'
menu2[17]='<a href="rpt_journal_distribution.asp">Journal Distribution State & city wise Reports</a>'
menu2[18]='<a href="rpt_print_order.asp">Print order Reports</a>'
//Sub-menu for Stocks menu
var menu3=new Array()
menu3[0]='<a href="addopeningstock.asp">Add Opening Stock</a>'
menu3[1]='<a href="addreceiptdetails.asp">Add Receipts</a>'
menu3[2]='<a href="adddespatchdetails.asp">Add Dispatch</a>'
menu3[3]='<a href="receiptreport.asp">View Receipts Report</a>'
menu3[4]='<a href="despatchreport.asp">View Dispatch Report</a>'
menu3[5]='<a href="stockstatusreport.asp">View Stock Status Report</a>'

//Sub-menu for Invoice menu
var menu4=new Array()
menu4[0]='<a href="searchinvoice_new.asp">Search Invoice</a>'
menu4[1]='<a href="confirm_DML.asp">Create DML</a>'
menu4[2]='<a href="send_dtwise_des_notification.asp">Send Dispatch Notification</a>'
menu4[3]='<a href="CustomInvoiceSearch.asp?custom=u">View Unverified Invoices</a>'
menu4[4]='<a href="CustomInvoiceSearch.asp?custom=v">View Verified Invoices</a>'
menu4[5]='<a href="CustomInvoiceSearch.asp?custom=c">View Cancelled Invoices</a>'

menu4[6]='<a href="Select_PI_List.asp" target="_blank">Create PI for MP</a>'
menu4[7]='<a href="print_pi_list.asp" target="_blank">Print PI For MP</a>'
menu4[8]='<a href="Select_EOSubs_PI_List.asp">Create PI For ES</a>'
menu4[9]='<a href="Print_EOSubs_PI_List.asp">Print PI For ES</a>'
menu4[10]='<a href="http://www.medknow.com/addpayment.asp" target="_blank">Online Payments</a>'
menu4[11]='<a href="Invoicepayref.asp">Refund Entry</a>'

//Sub-menu for Import menu
var menu5 = new Array()
menu5[0]='<a href="importmembers.asp">Import ML</a>'
menu5[1]='<a href="importeditorsubscribers.asp">Import ES</a>'
menu5[2]='<a href="em_import.asp">Import EM</a>'
menu5[3]='<a href="cl_import.asp">Import CL</a>'
menu5[4]='<a href="import_awb.asp">Import AWBs</a>'
menu5[5]='<a href="importFFData.asp">Upload FF data</a>'
menu5[6]='<a href="importCLjournal.asp">import CL journal</a>'
//Sub-menu for administration menu
var menuwidth='165px' //default menu width
var menubgcolor='#EBEBEB'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

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="-500px"
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_x(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv_x") : 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 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)
}

function CleanEmail(EmailVal)
{
	EmailVal = trimstr(EmailVal);
	EmailVal = EmailVal.replace('\t','');
	EmailVal = EmailVal.replace('\n','');
	EmailVal = EmailVal.replace('\r','');
	EmailVal = EmailVal.replace('\0','');
	EmailVal = EmailVal.replace('\x0B','');
	EmailVal = trimstr(EmailVal);

	return EmailVal;
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu



if (ie4||ns6)
{
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')
document.write('<div id="dropmenudiv_x" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

}

function openPopupWin(pagename)
{
	window.open(pagename, '','toolbar=1,location=0,directories=0,status=0, menubar=0,scrollbars=2,resizable=1,width=600,height=300,left=200,top=200');
}

var last_w;
function handleEnterBC (field, event) {
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		} 
		else
		return true;
	}  
 function chkbcform()
	{
		if (document.formbcsrch.srch.value=="")
		{
			alert("Please enter code !");
			document.formbcsrch.srch.focus();
			return  false;
		}
		//alert('test');
	}

	function scanBC()
	{

			document.formbcsrch.submit()


	}