﻿// JScript File

// ENVIA NÚMEROS PISO E LOJA PARA FLASH

function Loja(strValue) {
   var sendText = strValue
   //alert(sendText);
   window.document.Pisos.SetVariable("strParams", sendText);
}

function GetLoja(strValue) {
    //alert(strValue);
    setCookie('shop', strValue);
    document.location.href = "Content.aspx?id=166&shop=" + strValue;
    // document.getElementById("ShopInfo").src = "SpecialPages/ShopInfo.aspx?shop=" + strValue;
}

function GetLojaIF(strValue) {
    setCookie('shop', strValue);
    // alert(strValue);
    document.getElementById("ShopInfo").src = "SpecialPages/ShopInfo.aspx?shop=" + strValue;
}

function CookieLoja() {
   var sendText = getCookie('shop');
   // window.document.Pisos.SetVariable("strParams", sendText); 
   var flashObj = getFlashMovie("Plants");
   flashObj.SetVariable("strParams", sendText);
}

// OBJECTOS DO FLASH MOVIE
function getFlashMovie(movieName) {
    var flashObj = (document[movieName] == null) ? window[movieName] : document[movieName];
    return flashObj;
}

// COOKIE - MEMÓRIA
function setCookie(c_name,value,expiredays) {
    var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name)
{
    if (document.cookie.length>0)
      {
      c_start=document.cookie.indexOf(c_name + "=");
      if (c_start!=-1)
        { 
        c_start=c_start + c_name.length+1; 
        c_end=document.cookie.indexOf(";",c_start);
        if (c_end==-1) c_end=document.cookie.length;
        return unescape(document.cookie.substring(c_start,c_end));
        } 
      }
    return "";
}


function txtUser_Click()
{
    document.getElementById("txtUser").value = "";
}

function txtPass_Click()
{
    document.getElementById("txtPass").value = "";
}

function setPic(obj, oDesc)
{
    //dvBoxImage.style.display = "block";
    document.getElementById("BoxImage").src = obj;
    // myDesc.innerHTML = oDesc;
}
function closePic()
{
    dvBoxImage.style.display = "none";
}

function DisplayContent( contentid )
{
    document.location.href = "Content.aspx?id=" + contentid;
}

function openMenuFlash(channelid)
{
    var flashObj = getFlashMovie("menu");
    if(navigator.appName.indexOf("Microsoft") > -1)
        flashObj.sendTextToFlash(channelid);
}

function getFlashMovie(movieName) {
    var flashObj = (document[movieName] == null) ? window[movieName] : document[movieName];
    return flashObj;
}


function menu_DoFSCommand(command, args) 
{
    var sampleFlaMovieObj = getFlashMovie("menu");
    
    if (command == "DisplayContent")
    {
        var args1 = args;
        DisplayContent(args1);
    }
}

// Hook for Internet Explorer
if (navigator.appName && 
  navigator.appName.indexOf("Microsoft") != -1 &&
  navigator.userAgent.indexOf("Windows") != -1 && 
  navigator.userAgent.indexOf("Windows 3.1") == -1) 
{
  document.write('<SCRIPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write(
    'Sub menu_FSCommand(ByVal command, ByVal args)\n');
  document.write(
    ' call menu_DoFSCommand(command, args)\n');
  document.write('end sub\n');
  document.write('</SCRIPT\> \n');
}


/********************************************
START - PASSATEMPO MOVIES
*********************************************
*/
function OpenMovie( nMovie ) {
    OpenDivPassatempo();
    
    var objFrame = document.getElementById("IFPassatempo"); 
    
    switch ( nMovie ) {
        case 1:
            objFrame.src = "Movies.aspx";
            break;
        case 2:
            objFrame.src = "MoviesStarWars.aspx";
            break;
        default:
            break;
    } 
    
}
function OpenMovieSW() {
    OpenDivPassatempoSW();
    
    var objFrame = document.getElementById("IFPassatempoSW"); 
    
    objFrame.src = "MoviesStarWars.aspx";
    
}

function OpenDivPassatempo() 
{
    document.getElementById("dvPassatempo").style.visibility = 'visible';
    document.getElementById("dvPassatempo").style.display = 'block';     
}

function CloseDivPassatempo() 
{
    document.getElementById("dvPassatempo").style.visibility = 'hidden';
    document.getElementById("dvPassatempo").style.display = 'none';    
}

function OpenDivPassatempoSW() 
{
    document.getElementById("dvPassatempoSW").style.visibility = 'visible';
    document.getElementById("dvPassatempoSW").style.display = 'block';    
}

function CloseDivPassatempoSW() 
{
    document.getElementById("dvPassatempoSW").style.visibility = 'hidden';
    document.getElementById("dvPassatempoSW").style.display = 'none';    
}
/********************************************
END - PASSATEMPO MOVIES
*********************************************
*/
function fileCheck(img)
{ 	
    if( (picfile.width!=0) && (picfile.height!=0) )
    { 
        makeWindow(img); 
    }
    else 
    {
        funzione="fileCheck('"+img+"')"; 
        intervallo=setTimeout(funzione,50); 
    }
}

function makeWindow(img)
{ 	
    ht = picfile.height + 20;
    wd = picfile.width + 20; 

    var args= "height=" + ht + ",innerHeight=" + ht;
    args += ",width=" + wd + ",innerWidth=" + wd;
    if (window.screen) 
    { 
        var avht = screen.availHeight; 
        var avwd = screen.availWidth;
        var xcen = (avwd - wd) / 2; 
        var ycen = (avht - ht) / 2;
        args += ",left=" + xcen + ",screenX=" + xcen;
        args += ",top=" + ycen + ",screenY=" + ycen + ",resizable=yes"; 	
    }
    // return window.open(img, 'Imagem', args); 
    
	var popurl="SpecialPages/image.aspx?image=" + img
	winpops = window.open(popurl,"Imagem",args)
    
} 

function openPopUp(strPath) {

    picfile = new Image(); 
    picfile.src =(strPath); 
    fileCheck(strPath); 
}
