//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

var param_extra = "";
function setParamExtra(p_extra){
     param_extra = p_extra;
}

function getParamExtra(){
    return param_extra;
}

function AC_FL_RunContent(){   
  var prm_extra = getParamExtra();  
  var ret = 
    AC_GetArgs
    (  arguments, ".swf" + prm_extra, "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){  
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

//Função padrão para a abertura de popups
function WinOpen(sURL, sName, intTop, intLeft, intWidth, intHeight)
{
	var windowprops;
	if (null == sURL) {
		alert("ERROR: WinOpen() requires a URL");
		return;
	}
	if (null == sName)
		sName = '';
	if (null == intTop)
		intTop = 200;
	if (null == intLeft)
		intLeft = 200;
	if (null == intWidth)
		intWidth = 200;
	if (null == intHeight)
		intHeight = 200;
	windowprops = "location=no,scrollbars=yes,menubar=no,toolbar=no,locationbar=no,resizable=yes,alwaysRaised=yes,height="+intHeight+",width="+intWidth+",left="+intLeft+",top="+intTop;
	return window.open(sURL,sName,windowprops);
}
// função para o popup de login de empresas
function WinOpenEmpresas()
{
    //window.open("https://www.deville.com.br/ResOnline/PJUR_PTB/login_empresas.asp?cor=dev","Hoteis_Deville","height=500,width=580,left=90,top=10, scrolling= yes, status=yes"); 
    document.location.href("http://www.deville.com.br/reservas-on-line/loginB2B.aspx")
}

// função para o popup de login de Pessoas Fisicas
function WinOpenPessoa()
{
    //window.open("https://www.deville.com.br/ResOnline/PFIS_PTB/pgquadros.asp","Hoteis_Deville","height=500,width=580,left=90,top=10, scrolling= yes, status=yes"); 
    document.location.href("http://www.deville.com.br/reservas-on-line/meu-login.aspx")
}

function checking(checkInDateDay, checkInDateMonth, checkOutDateDay, checkOutDateMonth, adulto, crianca)
{
window.open("https://www.deville.com.br/ResOnline/PFIS_PTB/pgquadros.asp?consres=YES&"+checkInDateDay + "&" + checkInDateMonth + "&" + checkOutDateDay + "&" + checkOutDateMonth + "&" + adulto + "&" + crianca,"Hoteis_Deville","height=500,width=580,left=90,top=10, scrolling= yes, status=yes"); 
}

function imprime()
{
    window.print();
}
