
var timerID = 0;

/* Ajax Response Object*/
var Response = new ResponseStruct
function ResponseStruct()
{
    this.Message;
    this.Content;
    this.SortExpression;
    this.PreviousIsEnabled;
    this.NextIsEnabled;
    this.PageIndex;
    this.TotalPages;
    
    this.ShapeID;
    this.ShapeChecked;
    this.AllChecked;
    this.QueryString;
    this.VirtualLink;
    
    this.NiceMode; 
}

function FilterState()
{
    this.Shape;
    this.Vendor;
    this.Color;
    this.Cut;
    this.Clarity;
    this.Weight;
    this.Price;
    this.Rating;
    this.Cert;
}
var flashObject = null;
function ShowFlash(container, width, height, url, values)
{
    flashObject = new SWFObject( url , "PanelId", width, height, "8", "#ffffff");
    flashObject.addParam("allowScriptAccess", "sameDomain");
    flashObject.addParam("FlashVars", values);
    flashObject.addParam("swLiveConnect", "true");
    //so.addParam("wmode", "transparent");
    flashObject.write(container);
}

function CreateFlash(ID,divId,w,h,url,v) 
{
    var d = document.getElementById(divId);
    if (d != undefined)
    {
        //var c = "codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'";
        c = "";
        var s = "<object id='" + ID + "' style='text-align:left' data='" + url + "' type='application/x-shockwave-flash' " + c +  
                " width='" + w + "' height='" + h +"'>" +
                "<param name='movie' value='" + url + "'/>" +
                "<param name='FlashVars' value='selected=" + v + "'/>" + 
                "<param name='swLiveConnect' value='true'/>" + 
                "<param name='allowScriptAccess' value='Always' /></object>";
        d.innerHTML = s;
    }
}

function Delay(millis) 
{
    var date = new Date();
    var curDate = null;

    do { curDate = new Date(); } 
    while(curDate-date < millis);
} 

function Rand ( n )
{
    return ( Math.floor ( Math.random ( ) * n + 1 ) );
}

function getValuesShape(values)
{   
    FlashCall('Shape', values);
}
function getValuesWeight(values)
{   
    FlashCall('Weight', values);
}
function getValuesPrice(values)
{   
    FlashCall('Price', values);
}
function getValuesColor(values)
{   
    FlashCall('Color', values);
}
function getValuesCut(values)
{   
    FlashCall('Cut', values);
}
function getValuesCert(values)
{   
    FlashCall('Cert', values);
}
function getValuesClarity(values)
{   
    FlashCall('Clarity', values);
}

$(function()
{
    var loc = document.location.pathname.split("/");
    var topItemId = "#_" + loc[loc.length - 1].split(".")[0].toLowerCase();
    if (document.location.pathname.indexOf("loose-") > -1 || topItemId == "#_")
    {
        topItemId = "#_default";
    }
    //$(topItemId).addClass("active").removeAttr("href");
    $(topItemId).addClass("MenuItemSelected").removeAttr("href");
    
    var bottomItemId = "#" + loc[loc.length - 1].split(".")[0].toLowerCase();
    if (document.location.pathname.indexOf("loose-") > -1 || bottomItemId == "#")
    {
        bottomItemId = "#default  ";
    }

    $(bottomItemId).addClass("BottomMenuItemSelected").removeAttr("href");

    //BT_setOptions({openWait:500, closeWait:1000, enableCache:false});
})
