﻿function na_preload_img()
{
 var img_list = na_preload_img.arguments;
 if (document.preloadlist == null)
 document.preloadlist = new Array();
 var top = document.preloadlist.length;
 for (var i=0; i < img_list.length; i++) {
 document.preloadlist[top+i] = new Image();
 document.preloadlist[top+i].src = img_list[i+1];
 }
}

function change_style(obj, className)
{
    obj.className = className;
}

function na_restore_img_src(name, nsdoc)
{
 var img = eval((navigator.appname.indexof('netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
 if (name == '')
 return;
 if (img && img.altsrc) {
 img.src = img.altsrc;
 img.altsrc = null;
 }
}

function viewDetails(sender, divID)
{
    if(sender.innerHTML == "Show Details")
    {
        sender.innerHTML = "Hide Details";
        $get(divID).style.display = '';
    }
    else
    {
        sender.innerHTML = "Show Details";
        $get(divID).style.display = 'none';
    }
}

function viewScreens(sender, divID)
{
    if(sender.innerHTML.indexOf("Show Screens") != -1)
    {
        sender.innerHTML = sender.innerHTML.replace("Show Screens", "Hide Screens");
        $get(divID).style.display = '';
    }
    else
    {
        sender.innerHTML = sender.innerHTML.replace("Hide Screens", "Show Screens");
        $get(divID).style.display = 'none';
    }
}

function validateLogin(loginID, passwordID, errorID)
{
    var login = $get(loginID);
    var password = $get(passwordID);
    var error = $get(errorID);
    if(login && password && error)
    {
        if(login.value.length == 0)
        {
            error.innerHTML = "Please fill login field!&nbsp;&nbsp;&nbsp;<br />";
            error.style.display = "";
            return false;
        }
        if(password.value.length == 0)
        {
            error.innerHTML = "Please fill password field!&nbsp;&nbsp;&nbsp;<br />";
            error.style.display = "";
            return false;
        }
        error.style.display = "none";
        return true;
    }
    return false;
}

function onDownloadProduct(productPlatfromID, name, type)
{
    PageMethods.AddDownloadProduct(productPlatfromID, type,
                        function(){
                            window.location.href = "Download-Game.aspx?product=" + productPlatfromID + "&name=" + name + "&type=" + type;
                        },
                        function(exception)
                        {
                            alert(exception.get_message());
                        }
                    );
}

function onViewLiveDemo(name, path, width, height)
{
    var windowWidth = width + 10;
    var windowHeight = height + 10;
    var newWindow = window.open('', '', 'height=' + windowHeight + ',width=' + windowWidth + ',location=no,toolbar=no,titlebar=no,resizable=no,status=no,menubar=no,scrollbars=no');
    var content = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="241" HEIGHT="354">';
    content += '<PARAM NAME=movie VALUE="' + path + '"> ';
    content += '<PARAM NAME=quality VALUE=high>';
    content += '<PARAM NAME=bgcolor VALUE=#34363C>';
    content += '<EMBED src="' + path + '" quality=high bgcolor=#34363C  WIDTH="' + width + '" HEIGHT="' + height + '" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>';
    content += '</OBJECT>';
    newWindow.document.title = name;
    newWindow.document.body.style.padding = "0";
    newWindow.document.body.style.margin = "0";
    newWindow.document.body.innerHTML += "<div style='width:100%;height:100%;padding-top:10px;text-align:center;background-color:#34363C;'>" + content + "</div>";
}