 msgarray = new Array();
 
 zinxarray = new Array(0,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1)

 offleftarray = new Array(0,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17)
 offtoparray = new Array(0,30,30,36,40,30,30,30,37,30,30,30,30,30,30,30,30,30,30,30,30)

if (document.images)
{
  pic1= new Image(5,30); 
  pic1.src="/reqall_images/web/button_disabled_left_bg.png";

  pic2= new Image(6,30); 
  pic2.src="/reqall_images/web/button_disabled_right_bg.png";
}

function disable_signup_button(){
  if($('signup_button'))
    $('signup_button').className = 'detail_button_disabled';

  if($('img_submit_left')){
   if(pic1){
     $('img_submit_left').src = pic1.src;
   }else{
     $('img_submit_left').src = '/reqall_images/web/button_disabled_left_bg.png'
   }
  }
  if($('img_submit_right')){
   if(pic2){
     $('img_submit_right').src = pic2.src;
   }else{
     $('img_submit_right').src = '/reqall_images/web/button_disabled_right_bg.png'
   }
  }
}


function popupmsg(id){
 if($("error_"+id))
  $("error_"+id).style.visibility='visible';
}


function getElementObj(id){
     if (document.all) 
return document.all[id]; 
     return document.getElementById (id);
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	//alert("currleft:"+curleft);
	return [curleft,curtop];
}

function closeMsg(id){ 
 $(id).style.visibility='hidden';
}

function generateErrorMsg(emsg,id,lcorrect){
  if(emsg == '') { return; }

  numid = parseInt(id);
  parray = findPos($('errorimg'+id));
  loffset = (parray[0] + offleftarray[numid]);
  topoffset = (parray[1] - offtoparray[numid]);

  str = ''
  str += '<div id="error_'+ id +'" style="position: absolute; width: 250px; left: '+ loffset +'px; top: '+ topoffset +'px; z-index: ' + zinxarray[numid] +'"><table border="0" cellspacing="0" cellpadding="0">';
  str += '<tr>';
  str += '  <td></td>';
  str += '  <td><img src="/reqall_images/left_top.png" alt="corner" height="7" width="7" border="0" /></td>';
  str += '  <td background="/reqall_images/top.png"></td>';
  str += '  <td><img src="/reqall_images/right_top.png" alt="corner" height="7" width="7" border="0" /></td>';
  str += '</tr>';
  str += '<tr>';
  str += '	<td><img src="/reqall_images/arrow.png" alt="Arrow" height="30" width="17" border="0" /></td>';
  str += '	<td background="/reqall_images/left.png"></td>';
  str += '	<td bgcolor="#fff799">';
  str += '    <table border="0" cellspacing="0" cellpadding="4">';
  str += '      <tr>';
  str += '       <td rowspan="2" valign="top" class="body">'+emsg+'</td>';
  str += '       <td rowspan="2" valign="top"><img src="/reqall_images/close.gif" alt="Close" height="13" width="13" border="0" onclick="closeMsg(\'error_'+id+'\')" /></td>';
  str += '      </tr>';
  str += '      <tr></tr>';
  str += '    </table>';
  str += '  </td>';
  str += '  <td background="/reqall_images/right.png"></td>';
  str += '</tr>';
  str += '<tr>';
  str += '	<td></td>';
  str += '	<td><img src="/reqall_images/left_bottom.png" alt="corner" height="7" width="7" border="0" /></td>';
  str += '	<td background="/reqall_images/bottom.png"></td>';
  str += '	<td><img src="/reqall_images/right_bottom.png" alt="corner" height="7" width="7" border="0" /></td>';
  str += '</tr>';
  str += '</table></div>';
  return str;
}

function checkerrormsgs() {
  for(var id=1;id<10;id++) {
    if($("error_"+id)) { 
      eobj = $("error_"+id);
      if(eobj.visible) {      
        parray = findPos(eobj);
        left = (parray[0] + offleftarray[id]);
        top = (parray[1] - offtoparray[id]);
      
        eobj.style.left = left;
        eobj.style.top = top;
      }
    }
  }
}
