﻿// JScript File
var LoadDemos=true;
function overtab(o)  
{
    if (o.id==tabselect)
        return;
    o.style.background="url(img/tabon.gif)";
}
function outtab(o)   {
    if (o.id==tabselect)
        return;
    o.style.background="url(img/taboff.gif)";
}
var showedpromo=false;
function showpromo()   {
    if (!showedpromo)    {
     var w,h;
     if (window.innerWidth)
           w = window.innerWidth;
     else if ((document.body) && (document.body.clientWidth))
           w = document.body.clientWidth;
     if (document.documentElement && document.documentElement.clientWidth)
     {
         w = document.documentElement.clientWidth;
     }
      
     var x=(w/2)-184;
     GEID("promoholder").style.top="250px";
     GEID("promoholder").style.left=x+"px";
     GEID("promoholder").style.visibility='visible';
     showedpromo=true; 
   } 
}
function closepromo()   {
   GEID("promoholder").style.visibility='hidden';
}
function clicktab(o,loaddemos)  {
    LoadDemos=loaddemos;
   GEID("spotlighttab").style.background="url(img/taboff.gif)";
   GEID("downloadtab").style.background="url(img/taboff.gif)";
   GEID("buytab").style.background="url(img/taboff.gif)"; 
   o.style.background="url(img/tabon.gif)";
   tabselect=o.id;
   switch(o.id) {
    case "spotlighttab":
        pageproduct(1,1);
    break;
    case "downloadtab":
        pageproduct(1,2); 
    break;  
   case "buytab":
        pageproduct(1,3); 
        //showpromo();
    break;   
   }
}

function GoDownload(pid,loc)  {
    var l="";
     if (loc!=null)
        l="&location="+escape(loc);
     frames["frmUtility"].location.href="download.aspx?ProductID="+pid+l;
}
function popexamplesite()  {
}
function popscreenshots() {
    popwin("screenshots.aspx?productid="+ProductID,750,700);
}
function popwin(url,width,height)
{
    window.open(url,null,"height="+height+",width="+width+",status=no,scrollbars=yes,toolbar=no,menubar=no,location=no,resizable=yes");
}
function pageproduct(page,type)   {
   RequestedFunctionCall="pageproduct('"+page+"','"+type+"')"; 
   ProductInformation.ProductPageGet(ProductID,page,type,RenderProduct);
}
function RenderProduct(o) {
   RenderDynamicContent(o);
   if (LoadDemos) 
   {
        LoadDemos=false;
        ProductInformation.ProductDemosGet(ProductID,RenderDemos);
   }
}
function digg()
{
    var page="";
    switch (ProductID.toString())    {
       case "1":
           page="New_software_generates_a_full_AJAX_NET_CMS_for_SQL_Server";
       break;
       case "9":
           page="Freeware_to_create_to_do_list_for_synching_two_databases";
       break; 
       case "10":
           page="Flash_image_uploaded_and_editor";
       break; 
   }
    window.open(page);
}
function technorati()
{
    var query="";
    switch(ProductID.toString())
    {
        case "1":
        query="AJAX+CMSCreator";
       break;
       case "9":
        query="DiffSchema";
       break;
       case "9":
        query="QuickPic";
       break; 
    }
   window.open("http://www.technorati.com/search/"+query); 
}
function fusion()  {
    var url="";
    switch(ProductID.toString())    {
       case "1":
        url="http://fusion.google.com/add?moduleurl=http%3A//www.developerinabox.com/g.xml"; 
       break; 
       case "9","10":
        alert("Sorry, we don't have a fusion applet for this product.");
       break;
    }
   if (url!="")    {
    window.open(url);
   } 
}
function synd(baseurl,urlparam,titleparam,useqm) {
   var desc="";
   var url="";
   switch (ProductID.toString())    {
       case "1":
           desc=escape("Generate an AJAX .NET admin website for your database");
           url=escape("http://www.developerinabox.com/article.aspx?productid=1"); 
       break;
       case "9":
           desc=escape("Create a to-do list of changes between 2 databases");
           url="http://www.developerinabox.com/article.aspx?productid=9"; 
       break; 
       case "10":
           desc=escape("Flash image editor - crop, zoom and rotate on the client and then upload to the server");
           url="http://www.developerinabox.com/article.aspx?productid=10"; 
       break; 
   }
   switch (baseurl)  {
       case "mailto":
        window.open("mailto:?subject="+desc+"&body="+url);
       break; 
       default:
        var qm="?";
        if (!qm)
            qm="&";  
        window.open(baseurl+qm+urlparam+"="+url+"&"+titleparam+"="+desc);
       break;
   }
}
function RenderDemos(o)   {
    GEID("productdemos").innerHTML=o;
}
function playvideo(id)   {
    popwin("flash/appdemo.aspx?appdemoid="+id,600,500);
}
function goschema(name)  {
    if (LoggedIn)   {
        frames["frmUtility"].location.href='download.aspx?schema='+name;
   }
   else
   {
        alert("Please register an account and login before downloading schemas");
   }
   return false;
}

if (typeof(Sys) !== 'undefined') {
    Sys.Application.add_load(pageloaded);
    Sys.Application.notifyScriptLoaded();
} 