
function showCollapseFade(linkNode, id, width, height,url,contextpath) {
        if(document.getElementById) {
        
        if(document.getElementById("TBX_sup_window") != null){
        	var boxtoBorder = document.getElementById("TBX_sup_window");
			var boxtoplayer = document.getElementById("TBX_sup_overlay");
       		dojo.dom.removeNode(boxtoBorder);
			dojo.dom.removeNode(boxtoplayer);
        }
		var boxframe = 	document.createElement("iframe");
		var boxtoplayer = document.createElement("div");
		var boxtoBorder = document.createElement("div");
		boxframe.id = "TBX_sup_HideSelect";
		boxtoplayer.id = "TBX_sup_overlay";
		boxtoBorder.id = "TBX_sup_window";
		boxtoplayer.style.width =document.body.clientWidth + "px";
		boxtoplayer.style.height = document.body.clientHeight + "px";
		boxframe.style.width = document.body.clientWidth + "px";
		boxframe.style.height = document.body.clientHeight + "px";
		
		if (typeof document.body.style.maxHeight === "undefined"){
			if (document.getElementById("TBX_sup_HideSelect") === null){
				document.body.appendChild(boxframe);
				document.body.appendChild(boxtoplayer);
				document.body.appendChild(boxtoBorder);
				TB_WIDTH = parseInt(width)//defaults to 630 if no paramaters were added to URL
			}
		}else{
				document.body.appendChild(boxframe);
				document.body.appendChild(boxtoplayer);	
				document.body.appendChild(boxtoBorder);
				TB_WIDTH = parseInt(width) + 7  //defaults to 630 if no paramaters were added to URL
				//alert(height);
		}
		
					ajaxLink(boxtoBorder,url,contextpath);
					TB_TOP = 50 + "px";
					TB_LEFT = (window.screen.width - TB_WIDTH)/2 + "px";
					boxtoBorder.style.top = TB_TOP 
					boxtoBorder.style.left = TB_LEFT 
					boxtoBorder.style.width = TB_WIDTH + "px";
				dojo.html.setOpacity(boxtoBorder,0);
				dojo.lfx.html.propertyAnimation(boxtoplayer,[{property:"opacity", start:0, end:0.3}],500).play();
				dojo.lfx.html.fadeShow(boxtoBorder,200).play(); 
		
		}
}


function closeInlinePopup (id) {
	var boxtoBorder = document.getElementById("TBX_sup_window");
	var boxtoplayer = document.getElementById("TBX_sup_overlay");
	dojo.lfx.chain(dojo.lfx.html.fadeHide(boxtoBorder,300),dojo.lfx.html.fadeHide(boxtoplayer,300),dojo.lfx.html.fadeHide(boxtoplayer,300)).play();
	boxframe = document.getElementById("TBX_sup_HideSelect");
	dojo.dom.removeNode(boxframe);
}
function removePopup(id){
	var boxtoBorder = document.getElementById("TBX_sup_window");
	var boxtoplayer = document.getElementById("TBX_sup_overlay");
	var boxframe = document.getElementById("TBX_sup_HideSelect");
	dojo.lfx.chain(dojo.lfx.html.fadeHide(boxtoBorder,300),dojo.lfx.html.propertyAnimation(boxtoplayer,[{property:"opacity", start:0.3, end:0}],500)).play();
	return true;
}

function ajaxLink(container, url,contextpath) {
  dojo.io.bind({
        url: url,
        content: {
            ajax:true,
            engine: 'dojo'
        },
        load:function(type, data, event) {
          container.innerHTML = data;
          return container.innerHTML ;
          
        }
  });
  // Update the Status Container
  container.innerHTML = '<div style="top: 50px; left: 213.5px; width: 597px; height:300px; text-align:center;vertical-align:middle;"><img src="http://www.huawei.com/images/ajax.gif"></div>';
}




function setCookie(name, value) {
  var expFromNow = 60*24*60*60*1000;  // Expires in 60 Days
  var exp = new Date(); 
  exp.setTime(exp.getTime() + expFromNow);
  document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
}


function getCookie(Name) 
{
        var search = Name + "="   
        if (document.cookie.length > 0) 
        { 
                offset = document.cookie.indexOf(search);
                if (offset != -1) //DOES COOKIE EXIST
                { 
                        offset += search.length;
                        end = document.cookie.indexOf(";", offset);
                        if (end == -1);
                                end = document.cookie.length;
                        end = offset + 1; //SINCE THE VALUE IS 0, IT HAS A LENGTH OF 1
                        return unescape(document.cookie.substring(offset, end));
                }    
        }
}

function ajaxSubmitFormObjectFinal(divID, url, htmlForm, evaluateJS,flag,displayobj,displayId,ajaxid) {
  var container = document.getElementById(divID);
  if (container && htmlForm) {
        // Sanity Check Passed\
        dojo.io.bind({
            url: url,
            method: "post",
            content: {
                ajax: true,
                engine: 'dojo',
                evaluateJS:evaluateJS
            },
            formNode: htmlForm,
            load: function(type, data) {
                if (evaluateJS) {
                  eval(data);
                  container.innerHTML = "";
                } else {
                  container.innerHTML = data;
                 
                }
            },
            encoding: "utf8"
        });
        container.innerHTML = '<div align="center"><img src="http://www.huawei.com/images/ajax.gif"><br/>Processing</div>';
  } else {
    alert("Container or Form Not Found");
  }


  return false;
}