/**/
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

/**/
function deleteCookie(name, path, domain)
{
    if (getCookie(name))
    {
        document.cookie = name + "=" + 
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

/**/
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

/**/
function ClipBoard(copyText)
{
	document.getElementById("holdtext").innerText = copyText;
	Copied=document.getElementById("holdtext").createTextRange();
	Copied.execCommand("Copy");
}

/*
*/

function ShowStatusMessage(){
  if (document.forms[0].StatusMessage.value!="")
    alert(document.forms[0].StatusMessage.value);
}

/*
*/

function __Submit3DV(name,argument){
	document.getElementById('EventSource').value=name; 
	document.getElementById('EventArgument').value=argument;
	document.forms[0].submit();
}

/*
*/

function closeWindow(window){
   if (window!=null) window.close();
   window=null;
}

/*
*/

function closeWindowsArray(windows){
   for (i=0;i<windows.length;i++){
     if (windows[i]!=null) windows[i].close();
     windows[i]=null;
   }
}


/**/
function openPopupWindow(type,url,width,height,resizable,scrollbars,windowToClose,features){
	var w,h;
	var leftPos,topPos;
	
	//Type 0: Centrada en la pantalla
	//     1: Centrada en el browser
	//     2: (0,0)
	//     3: (0,0) Maximized
	//     4: Centrada en la pantalla sin la barra de windows
	
	if (windowToClose!=null) windowToClose.close();
		
	w=width; h=height;
	
	if (type==1){
		if (document.all) {
			/* the following is only available after onLoad */
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}else if (document.layers) {
			w = window.innerWidth;
			h = window.innerHeight;
		}
		leftPos = (w-width)/2;
		topPos = (h-height)/2;
	}else  if (type==0){
		if (document.all || document.layers) {
			w = screen.availWidth;
			h = screen.availHeight;
		}	
		leftPos = (w-width)/2;
		topPos = (h-height)/2;		
	}else if (type==2){
		leftPos=0;
		topPos=0;
	}else if (type==3){
		leftPos=0;
		topPos=0;
		width=screen.availWidth-10;
		height=screen.availHeight-28;
	}else{
		if (document.all || document.layers) {
			w = screen.availWidth;
			h = screen.availHeight;
		}	
		
		leftPos = (w-width)/2-5;		
		topPos = (h-height)/2-14;
		
		if (leftPos<0) leftPos=0;
		if (topPos<0)  topPos=0;		
	}
	
	if (features==null)
		return window.open(url,'','resizable='+resizable+',scrollbars='+scrollbars+',width=' + width + ',height=' + height + ',top=' + topPos + ',left=' + leftPos);		
	else
		return window.open(url,'','resizable='+resizable+',scrollbars='+scrollbars+',width=' + width + ',height=' + height + ',top=' + topPos + ',left=' + leftPos+','+features);		
		
}

/**/
function strtrim(cad) { 
  cad2=cad;
  return cad2.replace(/^\s+/,'').replace(/\s+$/,''); 
} 




