function additional()
{
   return false;
}

function tracking(pageName, catalogName)
{
	return true;
//    if (__IT && __IT.page)
//        __IT.page(pageName, catalogName);
//    if (urchinTracker && pageName)
//        urchinTracker("/" + catalogName + "/" + pageName);
//    else if (urchinTracker)
//        urchinTracker("/" + catalogName);
}

function Init()
{
//    var aryImages = ["Jason-Kennedy-wb.jpg", "Roland-Smith-c.jpg", "11072-44317-thumb-a.jpg", "Andre-St-Pierre-b.jpg", "Craig-Light-a.jpg", "Greg-Liskey-a.jpg", "Lynn-Sicade-d.jpg", "Kevin-Richards-c.jpg", "11009-44282-thumb-a.jpg", "11038-44298-thumb-a.jpg", "11113-44355-thumb-a.jpg", "Chris-Brion-d.jpg", "John-Bzdel2-wd.jpg", "11081-44325-thumb-b.jpg", "11217-44454-thumb-b.jpg"];
	var aryImages = ["44300", "44289", "44073", "44402", "44449", "44416", "44369", "44660", "44109", "44368", "44303", "44616", "44148", "44111", "44072"];
//    var aryURLs   = ["11223-44460", "11004-44280", "11229-44467", "11016-44286", "11001-44277", "11078-44322", "11073-44318", "11081-44325", "11036-44238", "11072-44317", "11124-44366", "11183-44424", "11188-44429", "11017-44287", "11013-44283"];
//	var aryURLs   = ["11223", "11004", "11072", "11016", "11001", "11078", "11073", "11081", "11009", "11038", "11113", "11183", "11188", "11081", "11217"];
	var aryURLs   = ["11042", "11019", "11056", "11161", "11211", "11175", "11127", "11431", "11045", "11126", "11048", "11386", "11190", "11029", "11024"];
	var aryLink = ["/catalogviewer.html?category=engagement", "/catalogviewer.html?category=solitaires", "/catalogviewer.html?category=threestone", "/catalogviewer.html?category=engagement-invisible", "/catalogviewer.html?category=engagement-multiple"]
    
    function MenuAppend(aryAction)
    {
	var aryRet = new Array();
	var i;
	for(i = 0; i < aryAction.length; i++)
	    aryRet[i] = g_strAffiliateURL + "catalogviewer.html?category=" + aryAction[i];
	return aryRet;
    };
    function SetImage(oImg, oUrl, img, url)
    {
	if (!oImg || !oUrl) return;
	oImg.src = "/thumb/" + url + "-" + img + "-thumb-" + "a" + ".jpg";
//	oUrl.href = "/classic_pages/" + url + ".html";
	oUrl.href = "/catalogviewer.html?product=" + url;
    };
    
    var num1 = Math.round(Math.random() * 14);
    SetImage(GetElement("img1"), GetElement("link1"), aryImages[num1], aryURLs[num1]);
    var num2 = num1;
    while(num2 == num1)
	num2 = Math.round(Math.random() * 14);
    SetImage(GetElement("img2"), GetElement("link2"), aryImages[num2], aryURLs[num2]);
    var num3 = num1;
    while(num3 == num2 || num3 == num1)
	num3 = Math.round(Math.random() * 14);
    SetImage(GetElement("img3"), GetElement("link3"), aryImages[num3], aryURLs[num3]);
    var num4 = num1;
    while(num4 == num3 || num4 == num2 || num4 == num1)
	num4 = Math.round(Math.random() * 14);
    SetImage(GetElement("img4"), GetElement("link4"), aryImages[num4], aryURLs[num4]);

	if (GetElement("menulink1"))
	{
//		GetElement("menulink1").href	= aryLink[0];
		GetElement("menulink1").href	= "javascript:pageTracker._link('" + ((document.location.hostname == 'wishlist.uniteddiamonds.com') ? g_strAffiliateURL + aryLink[0] : aryLink[0]) + "');";
		GetElement("menulink1").id		= "exclude";
		GetElement("menulink2").href	= "javascript:pageTracker._link('" + ((document.location.hostname == 'wishlist.uniteddiamonds.com') ? g_strAffiliateURL + aryLink[1] : aryLink[1]) + "');";
		GetElement("menulink2").id		= "exclude";
		GetElement("menulink3").href	= "javascript:pageTracker._link('" + ((document.location.hostname == 'wishlist.uniteddiamonds.com') ? g_strAffiliateURL + aryLink[2] : aryLink[2]) + "');";
		GetElement("menulink3").id		= "exclude";
		GetElement("menulink4").href	= "javascript:pageTracker._link('" + ((document.location.hostname == 'wishlist.uniteddiamonds.com') ? g_strAffiliateURL + aryLink[3] : aryLink[3]) + "');";
		GetElement("menulink4").id		= "exclude";
		GetElement("menulink5").href	= "javascript:pageTracker._link('" + ((document.location.hostname == 'wishlist.uniteddiamonds.com') ? g_strAffiliateURL + aryLink[4] : aryLink[4]) + "');";
		GetElement("menulink5").id		= "exclude";
	}

//    tracking(DOCUMENTNAME, DOCUMENTGROUP);

	anchorIterate();
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
    if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
    else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function to_currency(val,currency)
{
    val = "" + Math.round(100 * val);
    var is_negative=(val < 0) ? true : false;
    if(is_negative)
	val=val.substring(1);
    while (val.length <= 2)
	val= "0" + val;
    var dec_point = val.length - 2;
    var first_part = val.substring(0,dec_point);
    var second_part = val.substring(dec_point);
    var result = first_part + "." + second_part;
    var sign = is_negative ? "-" : "";
    if(!currency)
	currency="";
    if(result == 0.00)
	result = 'Call';
    else
	result = sign + currency + result;
    return result;
}

function popup(imageName)
{
    newWindow = window.open('','newWindow','width=800,height=600,left=0,top=0,resizable=1,scrollbars=1');
//    newWindow.document.open();
    newWindow.location.href = imageName;
}

function priceUpdate()
{
    var pricingOrderForm = document.forms[1];
    
    var firstMetalType  = pricingOrderForm.elements[0].options[pricingOrderForm.elements[0].selectedIndex].value;
    var secondMetalType = pricingOrderForm.elements[1].options[pricingOrderForm.elements[1].selectedIndex].value;
    var ringSizeValue   = pricingOrderForm.elements[2].options[pricingOrderForm.elements[2].selectedIndex].value;
    pricingOrderForm.elements[5].value = pricingOrderForm.elements[0].options[pricingOrderForm.elements[0].selectedIndex].text;
    pricingOrderForm.elements[6].value = pricingOrderForm.elements[1].options[pricingOrderForm.elements[1].selectedIndex].text;
    pricingOrderForm.elements[7].value = pricingOrderForm.elements[2].options[pricingOrderForm.elements[2].selectedIndex].text;
    
    var rawCurrentPrice = priceArrayVal[firstMetalType][secondMetalType][ringSizeValue];
    
    pricingOrderForm.elements[3].value = to_currency((rawCurrentPrice * 2.5),"$");
    pricingOrderForm.elements[4].value = to_currency(rawCurrentPrice,"$");
    
    pricingOrderForm.item1.value = pricingOrderForm.skuCode.value + "\|" + pricingOrderForm.itemName.value + "\|" + to_currency(rawCurrentPrice,"");

    pageTracker._linkByPost(pricingOrderForm);

}

function anchorIterate()
{
    for (var i = 0; i < document.links.length; i++)
    {
		if (document.location.hostname != document.links[i].hostname && document.links[i].href.indexOf('javascript:') != 0 && document.links[i].id != "exclude" && document.links[i].className != "wishlist_com_wl_lnk_prev_wish")
//		if (document.location.hostname != document.links[i].hostname && document.links[i].href.indexOf('javascript:') != 0 && document.links[i].id != "exclude")
        {
            document.links[i].href = "javascript:pageTracker._link('" + document.links[i].href + "');false;";
        }
    }
}

function addCookieToCart(thisPage)
{
    var formLength = document.forms[1].elements.length;
    var a='-', b='-', c='-', z='-', v='-', k;
    var dc=_ubd.cookie;	
    if (dc)
    {
        a=_uGC(dc,'__utma='+_udh,';');
        b=_uGC(dc,'__utmb='+_udh,';');
        c=_uGC(dc,'__utmc='+_udh,';');
        z=_uGC(dc,'__utmz='+_udh,';');
        v=_uGC(dc,'__utmv='+_udh,';');
        thisPage += '?__utma=' + escape(a) + '&__utmb=' + escape(b) + '&__utmc=' + escape(c) + '&__utmz=' + escape(z) + '&__utmv=' + escape(v);
    }
    for(var i = 0; i < formLength; i++)
        if (document.forms[1].elements[i].name == 'option2|Link')
            document.forms[1].elements[i].value = "<a href='http://www.uniteddiamonds.com/classic_pages/" + thisPage + "' target='New'>United Diamonds</a>";
}
