function toggleBlock(pstrID){
  var myDiv = document.getElementById('d' + pstrID);
  if (myDiv){
    if (myDiv.style.display == 'none'){
      showBlock(pstrID);
    } else{
      hideBlock(pstrID);
    }
  }
} 
function showBlock(pstrID){
  var myDiv = document.getElementById('d' + pstrID);
  if (myDiv){
    myDiv.style.display = 'block';
    var myImage = document.getElementById('i' + pstrID);
    if (myImage){
      myImage.src = '/images/arrowdown.gif';
      myImage.alt = 'Hide';
    }
  }
}
function security_popup(){
	var url = 'https://seal.godaddy.com:443/verifySeal?sealID=1521824278024dc2e1a127113650c9ec217fbf0026329667129279723';		
	window.open(url,'SealVerfication','location=yes,status=yes,resizable=yes,scrollbars=yes,width=555,height=445');
}
function popup(url){
	window.open(url, 'newwin', 'width=800,height=480,scrollbars=yes,menubar=yes');
}

function openWin(url){
	window.open(url, 'newwin', 'width=640,height=480,scrollbars=yes,menubar=yes');
}
function flashpopupopener(url, width, height){
	window.open(url, 'presentation', 'width=' + width + ', height=' + height + ', scrollbars=no, menubar=yes');
}
function hideBlock(pstrID){
  var myDiv = document.getElementById('d' + pstrID);
  if (myDiv){
    myDiv.style.display = 'none';
    var myImage = document.getElementById('i' + pstrID);
    if (myImage){
      myImage.src = '/images/arrowright.gif';
      myImage.alt = 'Show';
    }
  }
}

function activePop(){
	window.open('/planInfo.html', 'newwin', 'width=300,height=300');
}
function upgradePop(id){
	window.open('/upgradeInfo.php?id='+id, 'newwin', 'width=300,height=300');
}
/*
// Show element with id "dX" where X is a number
function showBlock( b_id ) {
	block = document.getElementById( "d" + b_id );
	block.style.display = 'block';
}

// Remove element with id "dX" where X is a number
function hideBlock( b_id ) {
	block = document.getElementById( "d" + b_id );
	block.style.display = 'none';
}

//togglevisibility with id "dX" where X is a number
function toggleBlock( b_id ){
	elem = document.getElementById( "d" + b_id );
	if(elem.style.display == 'none' || elem.style.display == '' ){showBlock( b_id );}else{hideBlock( b_id );}
	
}
*/
// Hide an element with a given id.
function elem_hide( elem_id ) {
	elem = document.getElementById( elem_id );
	elem.style.visibility = "hidden";
}

// Show an element with a given id.
function elem_show( elem_id ) {
	elem = document.getElementById( elem_id );
	elem.style.visibility = "visible";
}

// Make sure a specific element is selected
function select_option( selectId, optVal ) {
	s = document.getElementById(selectId);
	for (x=0;x<s.options.length;x++) {
		if (s.options[x].value == optVal) {
			s.selectedIndex = x;
		}
	}
}

// Build a menu for location
function build_location( newId ) {
	s = document.getElementById(newId);
	if(s){
	s.options[0] = new Option('Please select location','');
	s.options[1] = new Option('Accountant');
	s.options[1].value='Accountant';
	s.options[2] = new Option('Attorney');
	s.options[2].value='Attorney';
	s.options[3] = new Option('Filing cabinet');
	s.options[3].value='Filing cabinet';
	s.options[4] = new Option('Office');
	s.options[4].value='Office';
	s.options[5] = new Option('Safe');
	s.options[5].value='Safe';
	s.options[6] = new Option('Safety deposit box');
	s.options[6].value='Safety deposit box';
	s.options[7] = new Option('Wallet');
	s.options[7].value='Wallet';
	s.options[8] = new Option('Other');
	s.options[8].value='Other';
	}
}

function set_element( elem_id, elem_value ) {
	e = document.getElementById( elem_id );
	e.value = elem_value;
}

function set_radio( elem_name, elem_value ) {
	e = document.form.elements[elem_name].value = elem_value;
}





var offsetX=0;
var offsetY=0;
var popup_offsetX=20;
var coordX=0;
var coordY=0;
var startWidth=0;
var startHeight=0;
var min_popup_top=0;
var min_popup_left=0;
var max_popup_top=0;
var max_popup_left=0;
var min_popup_width=0;
var min_popup_height=0;
var drag=false;
var resize=false;
var row_adjust=0;

function popup(title, src, width, height, e){
	e = e || window.event;
	var cursor=getOffsetPosition(e);
	var popup=document.getElementById('popup');
	document.getElementById('popup_window').style.width=width;
	document.getElementById('popup_window').style.height=height;
	document.getElementById('popup_window').src=src;
	document.getElementById('tt_title').innerHTML=title;
	var move_up=parseInt(height)
	
	//Top
	new_top=(cursor.y+5)+'px';
	
	//Left
	new_left=(cursor.x+5)+'px';
	popup.style.display="none";
	popup.style.top=new_top;
	popup.style.left=new_left;
}
function close_popup(){
	document.getElementById('popup').style.top="-1000px";
	document.getElementById('popup').style.left="-1000px";
}
function popup_startDrag(e){
	e = e || window.event;
	var cursor=getOffsetPosition(e);
	offsetY=cursor.y-parseInt(document.getElementById('popup').style.top);
	offsetX=cursor.x-parseInt(document.getElementById('popup').style.left);
  drag=true;
}
function popup_drag(e){
	e = e || window.event;
	if(!drag){return};
	max_popup_top=1000;
	max_popup_left=1000;
	var cursor=getOffsetPosition(e);
	var popup=document.getElementById('popup');
	//Top
	if((cursor.y-offsetY)<min_popup_top){
		popup.style.top=min_popup_top+'px';
	}else if((cursor.y-offsetY)>(max_popup_top-popup.offsetHeight)){
		new_top=(max_popup_top-popup.offsetHeight)+'px';
		if(parseInt(new_top)<0){new_top="2px";}
		popup.style.top=new_top;
	}else{
		popup.style.top=(cursor.y-offsetY)+'px';
	}
	//Left
	if((cursor.x-offsetX)<min_popup_left){
		popup.style.left=min_popup_left+'px';
	}else if((cursor.x-offsetX)>(max_popup_left-popup.offsetWidth)){
		popup.style.left=(max_popup_left-popup.offsetWidth)+'px';
	}else{
		popup.style.left=(cursor.x-offsetX)+'px';
	}
}
function popup_stopDrag(){
	drag=false;
}
function popup_startResize(e){
	e = e || window.event;
	var cursor=getOffsetPosition(e);
	var popup=document.getElementById('popup_window');
	offsetY=cursor.y;
	offsetX=cursor.x;
	startWidth=popup.style.width;
	startHeight=popup.style.height;
  resize=true;
}
function popup_resize(e){
	e = e || window.event;
	if(!resize){return};
	var popup=document.getElementById('popup_window');
	var popup_div=document.getElementById('popup');
	var cursor=getOffsetPosition(e);
	var heightDif=cursor.y-offsetY;
	var widthDif=cursor.x-offsetX;
	var newWidth=parseInt(startWidth)+widthDif
	var newHeight=parseInt(startHeight)+heightDif
	
	//Width
	if((newWidth)<min_popup_width){
		popup.style.width=min_popup_width+"px";
	}else if((max_popup_left-newWidth-parseInt(popup_div.style.left))<27){
		popup.style.width=popup.style.width;
	}else{
		popup.style.width=newWidth+"px";
	}
	//Height
	if((newHeight)<min_popup_height){
		popup.style.height=min_popup_height+"px";
	}else if((max_popup_top-newHeight-parseInt(popup_div.style.top))<63){
		popup.style.height=popup.style.height;
	}else{
		popup.style.height=newHeight+"px";
	}
}
function popup_stopResize(){
	resize=false;
}
function getOffsetPosition(e) {
	e = e || window.event;
	var cursor = {x:0, y:0};
	if (e.pageX || e.pageY) {
		cursor.x = e.pageX;
		cursor.y = e.pageY;
	}else {
		var de = document.documentElement;
		var b = document.body;
		cursor.x = e.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
		cursor.y = e.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
	}
	cursor.y=cursor.y-row_adjust;
	return cursor;
}
function disableSelection(target){
	if (typeof target.onselectstart!="undefined"){
		target.onselectstart=function(){return false;}
	}else if(typeof target.style.MozUserSelect!="undefined"){
		target.style.MozUserSelect="none";
	}
}