// GENERAL
function GetObject(inID) { 
	if (document.getElementById)
		return top.document.getElementById(inID);
	else if (document.all)
		return top.document.all[inID];
	else 
		return null;
}

function GetFlashObject(inID) { 
  if (window.document[inID]) { return window.document[inID]; }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[inID]) return document.embeds[inID]; 
  } else {
    return document.getElementById(inID);
  }
}

// POPUP
function LoadPopup(inSuffix, inImgURL) {
		ShowView('popup_'+inSuffix);
		ImgObj = new Image();
		ImgObj.src = inImgURL;
		ImgObj.suffix = inSuffix;
		ImgObj.onload = PopupImageLoaded;
}
function PopupImageLoaded() {
	pImg = GetObject('img_'+ this.suffix);
	if (pImg == null) { return true; }
	pImg.src = this.src;
	pImg.width = this.width;
	pImg.height = this.height;
}
function ClosePopup(inSuffix) {
	HideView('popup_'+inSuffix);
}
// IMAGE PRELOADER
/*
	<div id="bg" style="left: 50px; width: 300px; position: absolute; top: 50px; height: 20px; background-color: #dddddd"></div>
	<div id="bar" style="left: 50px; width: 1px; position: absolute; top: 50px; height: 20px; background-color: #000000"></div>
	<div id="percent" style="left: 180px; position: absolute; top: 50px"><font color="#ffffff"><b>0%</b></font></div><br>
	<div id="stat" style="left: 370px; position: absolute; top: 50px"><font face="arial" color="#ffffff"><b>0/0</b></font></div><br>
	<div id="donemsg" style="left: 140px; position: absolute; top: 90px"></div>
*/

var pics = new Array();
pics[0] = "http://lugital.com/lugital/img/back.gif";
pics[1] = "http://lugital.com/lugital/img/back2.gif";
pics[2] = "http://lugital.com/lugital/img/banner.gif";
pics[3] = "http://lugital.com/lugital/img/lugitalnet.gif";
pics[4] = "http://lugital.com/lugital/img/logomed.gif";

var ImageObj = new Array(pics.length);
var IsUsingLoadingBar = false;
var NumImageLoaded = 0;
var ImageTotalLoad = pics.length;
var cPercent = 0;

var barLayer = null;
var percentLayer = null;
var statLayer = null;
var doneMsgLayer = null;

function UpdateLoading() {
	if (IsUsingLoadingBar == true) { statLayer.innerHTML = "<font face='Arial' color='#FFFFFF'><B>" +NumImageLoaded+ "/" +ImageTotalLoad+ "</B></font>"; }
	var percent = Math.round(NumImageLoaded/ImageTotalLoad * 100);
	if (cPercent != percent)
	{
		cPercent = percent;
		if (IsUsingLoadingBar == true) { 
			barLayer.style.width = (cPercent*3) +"px";
			percentLayer.innerHTML = "<font color='#ffffff'><B>" +cPercent+ "%</B></font>";
		}
	}
	if (NumImageLoaded == ImageTotalLoad)
	{
		PreloadCompleted();
	}
}

function StartLoading() {
	if (document.getElementById || document.all) {
		if (IsUsingLoadingBar == true) { 
			barLayer = GetObject("bar");
			percentLayer = GetObject("percent");
			statLayer = GetObject("stat");
			alert(statLayer);
			doneMsgLayer = GetObject("donemsg");
		}
		for (i=0; i<pics.length; i++)
		{
			ImageObj[i] = new Image();
			ImageObj[i].onload = ImageLoaded;
			ImageObj[i].onerror = ImageFailed;
			ImageObj[i].src = pics[i];
		}
	}	else {
		PreloadCompleted();
	}
}

function PreloadCompleted() {
	alert('done');
}

function ImageFailed() {
	NumImageLoaded++;
	UpdateLoading();
}

function ImageLoaded() {
	NumImageLoaded++;
	if (NumImageLoaded>pics.length)
	return
	UpdateLoading();
}

// ANIMATION

	function FadeOut(inID) {
		oFrame = GetObject(inID);
    oFrame.style.filter="blendTrans(duration=1)";
    // Make sure the filter is not playing.
    if (oFrame.filters.blendTrans.status != 2) {
    		//oFrame.style.left = (parent.document.body.clientWidth /2) + parent.document.body.scrollLeft - (300/2);
    		//oFrame.style.top = (parent.document.body.clientHeight /2) + parent.document.body.scrollTop - (100/2);
        oFrame.filters.blendTrans.apply();
        oFrame.style.visibility="hidden";
        oFrame.filters.blendTrans.play();
    }
	}
	function FadeIn(inID) {
		oFrame = GetObject(inID);
    oFrame.style.filter="blendTrans(duration=1)";
    // Make sure the filter is not playing.
    if (oFrame.filters.blendTrans.status != 2) {
    		//oFrame.style.left = (parent.document.body.clientWidth /2) + parent.document.body.scrollLeft - (300/2);
    		//oFrame.style.top = (parent.document.body.clientHeight /2) + parent.document.body.scrollTop - (100/2);
        oFrame.filters.blendTrans.apply();
        oFrame.style.visibility="visible";
        oFrame.filters.blendTrans.play();
    }
	}

// FORM OBJECT CLIENT VALIDATION
function FormObj(inObj, inObjName, inValidationType) {
		pResult = false;
		switch (inValidationType){	
			case "Currency":
				alert(this.onkeydown.keyCode);
				//alert('tesdd');
				pResult = true;
				break;
				
			default:
				pResult = false;
				break;
		}
		
		return pResult;
}

function FormObjName_OnKeyUp(obj) {
	val = obj.value;
  newVal = '';
  val = val.split(' ');
  for(var c=0; c < val.length; c++) {
  	if (newVal != '') { newVal += ' '; }
  	if (val[c].indexOf("-") == -1) {
   		newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length).toLowerCase();
   	} else {
   		newVal2 = '';
   		val2 = val[c].split('-');
  		for(var d=0; d < val2.length; d++) {
  			if (newVal2 != '') { newVal2 += '-'; }
				newVal2 += val2[d].substring(0,1).toUpperCase() + val2[d].substring(1,val2[d].length).toLowerCase();
  		}
  		newVal += newVal2
   	}
  }
  obj.value = newVal;
}

function FormObjCurrency(fld, milSep, decSep, e) {
  var sep = 0;
  var key = '';
  var i = j = 0;
  var len = len2 = 0;
  var strCheck = '0123456789';
  var aux = aux2 = '';
  var whichCode = (window.Event) ? e.which : e.keyCode;

  if (whichCode == 13) return true;  // Enter
  if (whichCode == 8) return true;  // Delete
  key = String.fromCharCode(whichCode);  // Get key value from key code
  if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
  len = fld.value.length;
  for(i = 0; i < len; i++)
  if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != decSep)) break;
  aux = '';
  for(; i < len; i++)
  if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i);
  aux += key;
  len = aux.length;
  if (len == 0) fld.value = '';
  if (len == 1) fld.value = '0'+ decSep + '0' + aux;
  if (len == 2) fld.value = '0'+ decSep + aux;
  if (len > 2) {
    aux2 = '';
    for (j = 0, i = len - 3; i >= 0; i--) {
      if (j == 3) {
        aux2 += milSep;
        j = 0;
      }
      aux2 += aux.charAt(i);
      j++;
    }
    fld.value = '';
    len2 = aux2.length;
    for (i = len2 - 1; i >= 0; i--)
    fld.value += aux2.charAt(i);
    fld.value += decSep + aux.substr(len - 2, len);
  }
  return false;
}

function autoTab(input,len, e) {
  var keyCode = (isNN) ? e.which : e.keyCode; 
  var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
  if(input.value.length >= len && !containsElement(filter,keyCode)) {
    input.value = input.value.slice(0, len);
    input.form[(getIndex(input)+1) % input.form.length].focus();
  }

  function containsElement(arr, ele) {
    var found = false, index = 0;
    while(!found && index < arr.length)
    if(arr[index] == ele)
    found = true;
    else
    index++;
    return found;
  }

  function getIndex(input) {
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index == -1)
    if (input.form[i] == input)index = i;
    else i++;
    return index;
  }
  return true;
}

/*
Phone Number: <input type="text"
               size="15" name="phone" id="phone"
               onkeypress="return FormObjPhone(this, event) onkeyup="FormObjPhone(this) onchange="FormObjPhone(this)">
               (555) 555-5555
*/
function FormObjPhone(elm, e) {
    var keychar;

    // If used in onkeypress, pass in the event and this will
    // grab the character and do the right thing. This allows
    // for a smoother user experience than if the chars are
    // being visibly deleted.
    if (e) {
        var keynum;
        if (window.event) {
            keynum = e.keyCode
        }
        else if (e.which) {
            keynum = e.which
        }

        keychar = String.fromCharCode(keynum)
    }   

    // Allow a backspace to go through, so the user
    // can correct any typos.
    if (/[\b]/.exec(keychar)) {
        return true;
    } else {
        var p = elm.value + keychar;

        // Don't allow a leading 1 or 0. We also strip out all
        // non-numeric characters here to make the formatting
        // easier later on. This could be modified to allow
        // letters if you consider them valid.
        p = p.replace(/^[01]/,"");
        p = p.replace(/\D+/g, "");

        // You can easily change the formatting of the phone
        // number by editing the conditionals below.
        if (p.length > 0 && p.length < 3) {
            p = "("+p;
        }
        else if (p.length >= 3 && p.length < 7) {
            p = "("+p.substring(0,3)+") "+p.substring(3);
        }
        else if (p.length >= 7 && p.length < 10) {
            p = "("+p.substring(0,3)+") "+p.substring(3,6)+"-"+p.substring(6);
        }
        else if (p.length) {
            p = "("+p.substring(0,3)+") "+p.substring(3,6)+"-"+p.substring(6,10);
        }
        elm.value = p;

        return false;
    }
}

/*
function insertAtCursor(myField, myValue) {
  //IE support
  if (document.selection) {
    myField.focus();
    sel = document.selection.createRange();
    sel.text = myValue;
  }
  //MOZILLA/NETSCAPE support
  else if (myField.selectionStart || myField.selectionStart == '0') {
    var startPos = myField.selectionStart;
    var endPos = myField.selectionEnd;
    myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
  } else {
    myField.value += myValue;
  }
}
*/

// [END] FORM OBJECT CLIENT VALIDATION

// PANEL DHTML

function ToggleView(inID) {
	// Asign this class to Object: .hide { visibility:hidden; display: none; }
	pObj = GetObject(inID);
	//alert(pObj.style.display);	
	pObj.className = "";
	if (pObj.style.visibility == '' || pObj.style.visibility == 'hidden') {
		ShowView(inID);
	} else {
		HideView(inID);
		//var timer = setTimeout("HideView('"+inID+"');", 200);
	}
}

function ShowView(inID) {
	pObj = GetObject(inID);
	if (pObj.style.visibility == '' || pObj.style.visibility == 'hidden') {
		pObj.style.visibility = "visible";
		//pObj.style.display = "";
	}
}

function HideView(inID) {
	pObj = GetObject(inID);
	if (pObj.style.visibility == 'visible') {
		pObj.style.visibility = "hidden";
		//pObj.style.display = "none";	
	}
}

// [END] PANEL DHTML


/*
    pHTML = pHTML & "<hr><a href=javascript:parent.document.getElementById('IFrFrmTblOrder').style.visibility='hidden';>CANCEL</a> - "
    pHTML = pHTML & "<a href=javascript:parent.document.getElementById('IFrFrmTblOrder').style.visibility='hidden';SelectAll(FrmTableOrder.Tbl_ID);FrmTableOrder.onsubmit();>SAVE ORDER</a>"
    pHTML = pHTML & "<script FOR=window EVENT=onload LANGUAGE='JScript'>IFrameAutoResize('IFrFrmTblOrder');addHandle(document.getElementById('titlebar'), window);</script>"
*/
function MM_swapImgRestore() { 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { 
  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_swapImage() { 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function createIFrame(inIFrameID) {
  if (!document.createElement) {return true};
  var ie = false;
  if (navigator.appName == "Microsoft Internet Explorer") ie = true;

  if (!document.getElementById(inIFrameID) && document.createElement) {
    var sIframe = (ie)?'<iframe name='+inIFrameID+'></iframe>':'iframe';
    var tempIFrame = document.createElement(sIframe);
		
		if (!ie) tempIFrame.setAttribute('name',inIFrameID);
    tempIFrame.setAttribute('id',inIFrameID);
    tempIFrame.frameBorder = 'no';
    IFrameObj = document.body.appendChild(tempIFrame);

    if (document.frames) { IFrameObj = document.frames[inIFrameID]; }
  }
  if (navigator.userAgent.indexOf('Gecko') !=-1 && !IFrameObj.contentDocument) {
  	setTimeout('invoke()', 10);
    return false;
  }

  return false;
}

function IFrameAutoResize(inIFrameID) {
	parent.document.getElementById(inIFrameID).style.width=this.document.body.scrollWidth+'px';
	parent.document.getElementById(inIFrameID).style.height=this.document.body.scrollHeight+'px';
	return true;
}

function IFrameClose(inIFrameID) {
	parent.document.getElementById(inIFrameID).style.visibility='hidden';
	return true;
}

function PostProcess(inForm)
{
	pIFrameName = 'IFr' + inForm.name;
	createIFrame(pIFrameName);
	pObj = document.getElementById(pIFrameName);
  pObj.style.border = '0px';
	pObj.style.visibility = 'hidden';
	pObj.style.position = 'absolute';
  pObj.style.top = '1px';
  pObj.style.left = '1px';
  pObj.style.width  = '0px';
  pObj.style.height = '0px';
	inForm.target = pIFrameName;
	inForm.submit();
	return true;
}

function PostFrame(inForm)
{
	pIFrameName = 'IFr' + inForm.name;
	createIFrame(pIFrameName);
	pObj = document.getElementById(pIFrameName);
  pObj.style.border = '0px';
  pObj.style.width  = '100%';
  pObj.style.height = '100%';
	inForm.target = pIFrameName;
	inForm.submit();
	return true;
}

function PostPopup(inForm)
{
	pIFrameName = 'IFr' + inForm.name;
	createIFrame(pIFrameName);
	pObj = document.getElementById(pIFrameName);
  pObj.style.border = '1px';
	pObj.style.visibility = 'visible';
	//pObj.allowTransparency = true;
	//pObj.style.zIndex = 1000;
	//pObj.style.backgroundColor = 'transparent';
	pObj.style.position = 'absolute';
  pObj.style.top = '50px';
  pObj.style.left = '50px';
  pObj.style.width  = '1px';
  pObj.style.height = '1px';
	inForm.target = pIFrameName;
	inForm.submit();

	return true;
}

// CHAT
var the_timeout;
function ChatTick()
{
	//var iframe = document.getElementById("ChatTick");
	//var iframeDoc = iframe.Document;  
	the_timeout = setTimeout("window.location.reload();", 1200);
	//document.getElementById("ChatTick").reload();
	//the_timeout = setTimeout("ChatTick();", 1200);
}

function ChatInput(inText)
{
	parent.document.getElementById('chatinput').innerHTML = inText;
	parent.document.getElementById('chatinput').scrollTop=parent.document.getElementById('chatinput').scrollHeight;
}

function ChatClose()
{
	FrmChatStatus.chatstatus.value = '3';
	FrmChatStatus.submit();
}

function ChatRequest()
{
	var iframe = document.getElementById("ChatWindow");
	var iframeDoc = iframe.Document;   
	iframeDoc.FrmChatStatus.chatstatus.value = '4';
	iframeDoc.FrmChatStatus.submit();
}

/*
function ChatWasteTime() 
{
	var wastemilisec = 1000;
	var date = new Date();
	var curDate = null;
	
	do { curDate = new Date(); } 
	while(curDate-date < wastemilisec);
} 

// onkeypress="ChatEnterKey(event,this.form);"
function ChatEnterKey(e,inForm)
{
	var key=e.keyCode || e.which;
	if (key==13){
		inForm.onsubmit();
	}
}
*/


// COMBO
function AddDB(inSelecterValue,inLoadValue,inLoadText) { this[0] = inSelecterValue; this[1] = inLoadValue; this[2] = inLoadText; }

function LoadCombo(inSelecterValue, inDB, inCombo) {
	CleanAll(inCombo);
	for(var i=0; i < inDB.length; i++) {
		if (inDB[i][0] == inSelecterValue) {
			inCombo.options[inCombo.options.length]=new Option(inDB[i][2],inDB[i][1]);
		}
	}
}	



function MoveUp(combo)
{ 
	i=combo.selectedIndex;
	if (i>0)
	{
		Swap(combo,i,i-1);
		combo.options[i-1].selected=true;
		combo.options[i].selected=false;
	}
}

function MoveDown(combo)
{
	i=combo.selectedIndex;
	
	if (i<combo.length-1 && i>-1)
	{
		Swap(combo,i+1,i);
		combo.options[i+1].selected=true;
		combo.options[i].selected=false;
	}
}

function MoveToTop(combo)
{
	i=combo.selectedIndex;
	
	for (;i>0;i--)
	{
		Swap(combo,i,i-1);
		combo.options[i-1].selected=true;
		combo.options[i].selected=false;
	}
}

function MoveToBottom(combo)
{
	i=combo.selectedIndex;
	
	if (i>-1)
	{
		for (;i<combo.length-1;i++)
		{
			Swap(combo,i+1,i);
			combo.options[i+1].selected=true;
			combo.options[i].selected=false;
		}
	}
}

function Swap(combo,index1, index2)
{
	var savedValue=combo.options[index1].value;
	var savedText=combo.options[index1].text;
	
	combo.options[index1].value=combo.options[index2].value;
	combo.options[index1].text=combo.options[index2].text;
	
	combo.options[index2].value=savedValue;
	combo.options[index2].text=savedText;
}

function SelectValue(combo, inValue)
{
	for (var i=0;i<combo.options.length;i++)
	{
		if (combo.options[i].value == inValue) { 
			combo.options[i].selected=true;
		}
	}
}

function SelectAll(combo)
{
	for (var i=0;i<combo.options.length;i++)
	{
		combo.options[i].selected=true;
	}
}

function UnSelectAll(combo)
{
	for (var i=0;i<combo.options.length;i++)
	{
		combo.options[i].selected=false;
	}
}

function GetSelected(combo)
{
	pSelected = "";
	if (combo != null) {
		for (var i=0;i<combo.options.length;i++)
		{
			if (combo.options[i].selected == true) {
					if (pSelected != "") { pSelected += ", "; }
					pSelected += combo.options[i].value;
			}
		}
	}
	return pSelected;
}

function ComboToCombo(FromCombo,ToCombo)
{
	var to_remove_counter=0; //number of options that were removed (num selected options)
	
	//move selected options to right select box (to)
	for (var i=0;i<FromCombo.options.length;i++)
	{
		if (FromCombo.options[i].selected==true)
		{
			var addtext=FromCombo.options[i].text;
			var addvalue=FromCombo.options[i].value;
			ToCombo.options[ToCombo.options.length]=new Option(addtext,addvalue);
			FromCombo.options[i].selected=false;
			++to_remove_counter;
		}
		else
		{
			FromCombo.options[i-to_remove_counter].selected=false;
			FromCombo.options[i-to_remove_counter].text=FromCombo.options[i].text;
			FromCombo.options[i-to_remove_counter].value=FromCombo.options[i].value;
		}
	}
	
	//now cleanup the last remaining options 
	var numToLeave=FromCombo.options.length-to_remove_counter;
	for (i=FromCombo.options.length-1;i>=numToLeave;i--) 
	{ 
		FromCombo.options[i]=null;
	}
}


function CleanAll(combo)
{
	for (var i=0;combo.options.length=0;i++)
	{ 
		combo.options[0]=null; 
	}
}


// LAYERS
function show(id)
{
	var el = document.getElementById(id);
	el.className = 'visible';

	var a_id = 'a_' + id;
	el = document.getElementById(a_id);
	var jsf = 'javascript:hide(' + id + ')';
	el.href = jsf;
	
	var t_id = 't_' + id;
	el = document.getElementById(t_id);
	el.className = 'textsel';
	
}

function hide(id)
{
	var el = document.getElementById(id);
	el.className = 'hidden';

	var a_id = 'a_' + id;
	el = document.getElementById(a_id);
	var jsf = 'javascript:show(' + id + ')';
	el.href = jsf;
	
	var t_id = 't_' + id;
	el = document.getElementById(t_id);
	el.className = 'text';
}

function showAll(nb_ids)
{
	for (var i = 1; i <= nb_ids; i++)
	{
		var el = document.getElementById('sht' + i);
		el.href = 'javascript:hideAll(' + nb_ids + ')';
	}

	var els = document.getElementsByTagName('DIV');
	for (var i = 0; i < els.length; i++)
	{
		if (parseInt(els[i].id) > 0)
		{
			show(els[i].id);
		}
	}
}

function hideAll(nb_ids)
{
	for (var i = 1; i <= nb_ids; i++)
	{
		var el = document.getElementById('sht' + i);
		el.href = 'javascript:showAll(' + nb_ids + ')';
	}

	var els = document.getElementsByTagName('DIV');
	for (var i = 0; i < els.length; i++)
	{
		if (parseInt(els[i].id) > 0)
		{
			hide(els[i].id);
		}
	}
}

// CHECKBOX
function disableAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].disabled = true ;
}

function enableAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].disabled = false ;
}

function checkAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}

function checkAllToggle(chkall, field)
{
	for (i = 0; i < field.length; i++)
	field[i].checked = chkall.checked ;
}

function toggleCheckbox(thisCheckbox, inTR) {
  thisCheckbox.checked = !(thisCheckbox.checked);
  if (thisCheckbox.checked) {
  	inTR.className = 'tdsel';	
  } else {
  	inTR.className = 'tdnormal';	
	}
}

function TR_MouseOut(thisCheckbox, inTR) {
  if (thisCheckbox.checked) {
  	inTR.className = 'tdsel';	
  } else {
  	inTR.className = 'tdnormal';	
	}
}

function TR_MouseOut2(thisCheckbox, inTR) {
  if (thisCheckbox.checked) {
  	alert('sel');
  	inTR.className = 'tdsel';	
  } else {
  	alert('nor');
  	inTR.className = 'tdnormal';	
	}
}


function GetChecked(field)
{
	pChecked = "";
	if (field != null) {
		for (var i=0;i<field.length;i++)
		{
			if (field[i].checked == true) {
					if (pChecked != "") { pChecked += ", "; }
					pChecked += field[i].value;
			}
		}
		
		if (pChecked == "" && field.checked == true) { pChecked = field.value; }
	}
	return pChecked;
}


///////////////////////////////// DRAG N DROP IFRAME

// Variables used for "Draggable IFrame" (DIF) functions
var DIF_dragging=false;
var DIF_iframeBeingDragged="";
var DIF_iframeObjects=new Object();
var DIF_iframeWindows=new Object();
var DIF_iframeMouseDownLeft = new Object();
var DIF_iframeMouseDownTop = new Object();
var DIF_pageMouseDownLeft = new Object();
var DIF_pageMouseDownTop = new Object();
var DIF_handles = new Object();
var DIF_highestZIndex=99;
var DIF_raiseSelectedIframe=true; // Set to true to always raise the dragged iframe to top zIndex
var DIF_allowDragOffScreen=false; // Set to try to allow iframes to be dragged off the top/left of the document



// Method to be used by iframe content document to specify what object can be draggable in the window
function addHandle(o, win) {
	if (arguments.length==2 && win==window) {
		// JS is included in the iframe who has a handle, search up the chain to find a parent window that this one is dragged in
		var p = win;
		while (p=p.parent) {
			if (p.addHandle) { p.addHandle(o,win,true); return; }
			if (p==win.top) { return; } // Already reached the top, stop looking
			}
		return; // If it reaches here, there is no parent with the addHandle function defined, so this frame can't be dragged!
		}
	var topRef=win;
	var topRefStr = "window";
	while (topRef.parent && topRef.parent!=window) {
		topRef = topRef.parent;
		topRefStr = topRefStr + ".parent";
		}
	// Add handlers to child window
	if (typeof(win.DIF_mainHandlersAdded)=="undefined" || !win.DIF_mainHandlersAdded) {
		// This is done in a funky way to make Netscape happy
		with (win) { 
			eval("function OnMouseDownHandler(evt) { if(typeof(evt)=='undefined'){evt=event;}"+topRefStr+".parent.DIF_begindrag(evt, "+topRefStr+") }");
			eval("document.onmousedown = OnMouseDownHandler;");
			eval("function OnMouseUpHandler(evt) { if(typeof(evt)=='undefined'){evt=event;}"+topRefStr+".parent.DIF_enddrag(evt, "+topRefStr+") }");
			eval("document.onmouseup = OnMouseUpHandler;");
			eval("function OnMouseMoveHandler(evt) { if(typeof(evt)=='undefined'){evt=event;}"+topRefStr+".parent.DIF_iframemove(evt, "+topRefStr+") }");
			eval("document.onmousemove = OnMouseMoveHandler;");
			win.DIF_handlersAdded = true;
			win.DIF_mainHandlersAdded = true;
			}
		}
	// Add handler to this window
	if (typeof(window.DIF_handlersAdded)!="undefined" || !window.DIF_handlersAdded) {
		eval("function OnMouseMoveHandler(evt) { if(typeof(evt)=='undefined'){evt=event;}DIF_mouseMove(evt, window) }");
		eval("document.onmousemove = OnMouseMoveHandler;");
		window.DIF_handlersAdded=true;
		}
	o.style.cursor="move";
	var name = DIF_getIframeId(topRef);
	if (DIF_handles[name]==null) {
		// Initialize relative positions for mouse down events
		DIF_handles[name] = new Array();
		DIF_iframeMouseDownLeft[name] = 0;
		DIF_iframeMouseDownTop[name] = 0;
		DIF_pageMouseDownLeft[name] = 0;
		DIF_pageMouseDownTop[name] = 0;
		}
	DIF_handles[name][DIF_handles[name].length] = o;
	}

// Generalized function to get position of an event (like mousedown, mousemove, etc)
function DIF_getEventPosition(evt) {
	var pos=new Object();
	pos.x=0;
	pos.y=0;
	if (!evt) {
		evt = window.event;
		}
	if (typeof(evt.pageX) == 'number') {
		pos.x = evt.pageX;
		pos.y = evt.pageY;
	}
	else {
		pos.x = evt.clientX;
		pos.y = evt.clientY;
		if (!top.opera) {
			if ((!window.document.compatMode) || (window.document.compatMode == 'BackCompat')) {
				pos.x += window.document.body.scrollLeft;
				pos.y += window.document.body.scrollTop;
			}
			else {
				pos.x += window.document.documentElement.scrollLeft;
				pos.y += window.document.documentElement.scrollTop;
			}
		}
	}
	return pos;
}

// Gets the ID of a frame given a reference to a window object.
// Also stores a reference to the IFRAME object and it's window object
function DIF_getIframeId(win) {
	// Loop through the window's IFRAME objects looking for a matching window object
	var iframes = document.getElementsByTagName("IFRAME");
	for (var i=0; i<iframes.length; i++) {
		var o = iframes.item(i);
		var w = null;
		if (o.contentWindow) {
			// For IE5.5 and IE6
			w = o.contentWindow;
			}
		else if (window.frames && window.frames[o.id].window) {
			w = window.frames[o.id];
			}
		if (w == win) {
			DIF_iframeWindows[o.id] = win;
			DIF_iframeObjects[o.id] = o;
			return o.id; 
			}
		}
	return null;
	}

// Gets the page x, y coordinates of the iframe (or any object)
function DIF_getObjectXY(o) {
	var res = new Object();
	res.x=0; res.y=0;
	if (o != null) {
		res.x = o.style.left.substring(0,o.style.left.indexOf("px"));
		res.y = o.style.top.substring(0,o.style.top.indexOf("px"));
		}
	return res;
	}

// Function to get the src element clicked for non-IE browsers
function getSrcElement(e) {
	var tgt = e.target;
	while (tgt.nodeType != 1) { tgt = tgt.parentNode; }
	return tgt;
	}

// Check if object clicked is a 'handle' - walk up the node tree if required
function isHandleClicked(handle, objectClicked) {
	if (handle==objectClicked) { return true; }
	while (objectClicked.parentNode != null) {
		if (objectClicked==handle) {
			return true;
			}
		objectClicked = objectClicked.parentNode;
		}
	return false;
	}
	
// Called when user clicks an iframe that has a handle in it to begin dragging
function DIF_begindrag(e, win) {
	// Get the IFRAME ID that was clicked on
	var iframename = DIF_getIframeId(win);
	if (iframename==null) { return; }
	// Make sure that this IFRAME has a handle and that the handle was clicked
	if (DIF_handles[iframename]==null || DIF_handles[iframename].length<1) {
		return;
		}
	var isHandle = false;
	var t = e.srcElement || getSrcElement(e);
	for (var i=0; i<DIF_handles[iframename].length; i++) {
		if (isHandleClicked(DIF_handles[iframename][i],t)) {
			isHandle=true;
			break;
			}
		}
	if (!isHandle) { return false; }
	DIF_iframeBeingDragged = iframename;
	if (DIF_raiseSelectedIframe) {
		DIF_iframeObjects[DIF_iframeBeingDragged].style.zIndex=DIF_highestZIndex++;
		}
	DIF_dragging=true;
	var pos=DIF_getEventPosition(e);
	DIF_iframeMouseDownLeft[DIF_iframeBeingDragged] = pos.x;
	DIF_iframeMouseDownTop[DIF_iframeBeingDragged] = pos.y;
	var o = DIF_getObjectXY(DIF_iframeObjects[DIF_iframeBeingDragged]);
	DIF_pageMouseDownLeft[DIF_iframeBeingDragged] = o.x - 0 + pos.x;
	DIF_pageMouseDownTop[DIF_iframeBeingDragged] = o.y -0 + pos.y;
	}

// Called when mouse button is released after dragging an iframe
function DIF_enddrag(e) {
	DIF_dragging=false;
	DIF_iframeBeingDragged="";
	}

// Called when mouse moves in the main window
function DIF_mouseMove(e) {
	if (DIF_dragging) {
		var pos = DIF_getEventPosition(e);
		DIF_drag(pos.x - DIF_pageMouseDownLeft[DIF_iframeBeingDragged] , pos.y - DIF_pageMouseDownTop[DIF_iframeBeingDragged]);
		}
	}

// Called when mouse moves in the IFRAME window
function DIF_iframemove(e) {
	if (DIF_dragging) {
		var pos = DIF_getEventPosition(e);
		DIF_drag(pos.x - DIF_iframeMouseDownLeft[DIF_iframeBeingDragged] , pos.y - DIF_iframeMouseDownTop[DIF_iframeBeingDragged]);
		}
	}

// Function which actually moves of the iframe object on the screen
function DIF_drag(x,y) {
	var o = DIF_getObjectXY(DIF_iframeObjects[DIF_iframeBeingDragged]);
	// Don't drag it off the top or left of the screen?
	var newPositionX = o.x-0+x;
	var newPositionY = o.y-0+y;
	if (!DIF_allowDragOffScreen) {
		if (newPositionX < 0) { newPositionX=0; }
		if (newPositionY < 0) { newPositionY=0; }
		}
	DIF_iframeObjects[DIF_iframeBeingDragged].style.left = newPositionX + "px";
	DIF_iframeObjects[DIF_iframeBeingDragged].style.top  = newPositionY + "px";
	DIF_pageMouseDownLeft[DIF_iframeBeingDragged] += x;
	DIF_pageMouseDownTop[DIF_iframeBeingDragged] += y;
	}

//////////////////////////////////// END DRAG N DROP IFRAME


/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 	FIREFOX Fix for 100% stretch
 	<style>
		html { height: 100%; overflow: hidden; }
		#flashcontent { height: 100%;	}
		body { height: 100%; margin: 0; padding: 0;	}
	</style>
 <div id="flashcontent">This div must be before code</div>
 <script type="text/javascript">
 	 //var so = new SWFObject(swf, id, width, height, version, background-color [, quality, xiRedirectUrl, redirectUrl, detectKey]);
   var so = new SWFObject("movie.swf", "mymovie", "400", "100%", "8", "#336699");
   so.addParam("quality", "high");
   so.addParam("wmode", "transparent");
   so.addVariable("variable1", "value1");
   so.addVariable("variable2", "value2");
   so.addVariable("variable3", "value3");
   so.write("flashcontent");
</script>

 */

if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;