function setfocus() { 
	document.getElementById('myForm').lastname.focus(); 
	checkCookie();
}

function setfocus2() {
	document.getElementById('myForm').q.focus();
	checkCookie();
}

function checkCookie() {

	var xArr = getElementsByClassName("RequestLink")
	for (var i = 0; i < xArr.length; i++) {
		xArr[i].style.display = "block";
	}
	
	var cv = getCookie('bpldb');
	
	if (!cv) {	
	createCookie('bpldb','0');
	}
}

function createCookie(c_name,value) {
//	document.cookie = c_name + "=" + value + "; path=/; domain=bplonline.org;";
	document.cookie = c_name + "=" + value + "; path=/;"; 
}


function cookProc(obit_id) {
	var cv = getCookie('bpldb');
	
	if (cv) {		
		var ca = cv.split(':');

		if (ca.length > 0) {
	
		 	var match = 0;
		 	var cValue = 0;
	 	
			for(var i=0; i < ca.length; i++) {			
			
			
				if (ca[i] != obit_id) {
					if (cValue == 0) {
						cValue = ca[i];
					} else {
						cValue = cValue + ":" + ca[i];
					}		
				} else {
					if (match == 0) {
						if (cValue == 0) {
							cValue = obit_id;
						} else {
							cValue = cValue + ":" + obit_id;
						}
					
						match = 1;
					}
				}
			}
			if (match == 0) {
				if (cValue == 0) {
					cValue = obit_id;
				} else {
					cValue = cValue + ":" + obit_id;
				}

				match = 1;
			}
			
			createCookie('bpldb',cValue);
		
		} else  {
			createCookie('bpldb',obit_id);
		}
	} else {
		createCookie('bpldb',obit_id);
	}
}

function cookProcRemove(obit_id){
	var cv = getCookie('bpldb');
	
	if (cv) {
		var ca = cv.split(':');

		if (ca.length > 0) {
		 	var match = 0;
		 	var cValue = 0;
	 	
			for(var i=0; i < ca.length; i++) {			
				if (ca[i] != obit_id) {
					if (cValue == 0) {
						cValue = ca[i];
					} else {
						cValue = cValue + ":" + ca[i];
					}
				}
			}

			createCookie('bpldb',cValue);
		}
	}
}


function changeLink(toHide,toShow){
	document.getElementById(toHide).style.display = "none";
	document.getElementById(toShow).style.display = "inline";
}


function getCookie(c_name){
  	var results = document.cookie.match ( c_name + '=(.*?)(;|$)' );

  	if ( results )
    		return ( unescape ( results[1] ) );
  	else
    		return null;
}


function getElementsByClassName(class_name)
      {
        var all_obj,ret_obj=new Array(),j=0,teststr;

        if(document.all)all_obj=document.all;
        else if(document.getElementsByTagName && !document.all)
          all_obj=document.getElementsByTagName("*");

        for(i=0;i<all_obj.length;i++)
        {
          if(all_obj[i].className.indexOf(class_name)!=-1)
          {
            teststr=","+all_obj[i].className.split(" ").join(",")+",";
            if(teststr.indexOf(","+class_name+",")!=-1)
            {
              ret_obj[j]=all_obj[i];
              j++;
            }
          }
        }
        return ret_obj;
      }