//<!-- Copyright (c) 1999-2006 UniteU Technologies Inc.  All rights reserved.   //-->
// ************************************************************************************
// ****    DO NOT MODIFY THIS FILE!!!  **************************************************
// **************************************************************************************
//This file will be re-generated any time the site is upgrade, any changes will be lost.
//	Also, This folder is NOT included in Transfers.  Please make your own js file.

////////////////////////////////
// Product Reviews Functions  //
////////////////////////////////
function draw_rating_data()
{
    if (review_settings.use_ratings)
    {
        document.write("<table><tr><td valign=\"middle\" align=center><strong>Average Customer Rating</strong> <br />(based on ");
        document.write(product_reviews.review_count);
        document.write(" reviews) <br /><br />");
        //check for a rating image
        var img_src = "";
        var rndAveRating = Math.round(product_reviews.average_rating);
        if (review_scale.image_path != "")
        {
            img_src = review_scale.image_path;
        }
        document.write("<br><span class=\"ProductName\">" + rndAveRating + " out of " + review_scale.scale_item_count + "</span><br><br>");
        if (img_src != "")
        {
            for (n=1;n<=rndAveRating;n++)
            {
                document.write("<img src=\"" + img_src + "\" border=0 alt=\"\" />");
            }
        }

        document.write("<br /><br /><br /></td></tr></table>");
    }
}

function draw_review_data()
{
  //draw product review area
    var img_src = "";
    var global_img_flag = false;
    if (review_scale.image_path != "")
    {
        //there is a global image defined for the scale
        //can check for and use individual images for each scale item
        img_src = review_scale.image_path;
        global_img_flag = true;
    }
    document.write("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">");
    //document.write("<tr valign=\"top\"><td width=\"20\">&nbsp;</td><td colspan=\"3\"><span class=\"ProductName\">Customer Reviews</span><br><br></td></tr>");
    document.write("<tr><td>&nbsp;</td>");
    document.write("<td colspan=\"3\" valign=\"middle\"><a href=\"post_review.asp\" onclick=\"return(visitargs('post_review.asp','pf_id=" + pf_id + "&dept_id=" + dept_id + "','URL'));\">Write a Review!</a>");
    var urltemp = document.location.href;
    if (urltemp.indexOf("product_reviews.asp") == -1)
    {
        document.write("&nbsp; &nbsp; &nbsp; <a href=\"product_reviews.asp\" onclick=\"return(visitargs('product_reviews.asp','pf_id=" + pf_id + "&dept_id=" + dept_id + "','URL'));\">See All Reviews</a>");
    } else {
        draw_rev_spanner();
    }
    document.write("</td></tr><tr><td colspan=4>&nbsp;</td></tr>");
    document.write("<tr><td>&nbsp;</td><td colspan=3>");
    document.write("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" class=\"SubHeadbgcolor\"><tr><td><table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">");
    document.write("<tr valign=\"top\"><td colspan=\"3\"><span class=\"SubHeadText\">Here's what people are saying about this product:</span></td></tr>");
    for (i=0;i<product_reviews.review_items.length;i++)
    {
        document.write("<tr>");
        if (review_settings.use_ratings)
        {
            document.write("<td nowrap valign=\"middle\" class=\"tablebgcolor\">");
            //check for item image, if not then loop and draw multiple scale images
            for (j=1;j<=product_reviews.review_items[i].review_rating;j++)
            {
                document.write ("<img src=\"" + img_src + "\" border=0 alt=\"\" />");
            }
            document.write("</td>");
        }

        document.write("<td valign=\"top\" class=\"tablebgcolor\"><strong>\"" + product_reviews.review_items[i].review_subject + "\"</strong>&nbsp;<i>by&nbsp;");
        if (product_reviews.review_items[i].reviewer_email != "")
        {
            document.write("<a href=\"mailto:" + product_reviews.review_items[i].reviewer_email + "\">" + product_reviews.review_items[i].reviewer_name + "</a>");

        }else{
            document.write(product_reviews.review_items[i].reviewer_name);
        }
        document.write(" on " + product_reviews.review_items[i].review_date + "</i><br /><br />");
        for(k=1;k<=10;k++)
        {
            if (eval("product_reviews.review_items[i].value"+k) != "")
            {
                document.write("<strong>" + eval("review_labels.field_label"+k) + ":</strong> " + eval("product_reviews.review_items[i].value"+k) + "<br />");
            }
         }
        document.write("</td></tr>");
    }
    document.write("</table></td></tr></table></td></tr></table><br><br>");
}

function draw_review_form()
{
    document.write("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" class=\"SubHeadbgcolor\"><tr><td><table cellpadding=\"10\" cellspacing=\"1\" border=\"0\" width=\"100%\">");
    document.write("<tr valign=\"top\"><td colspan=\"3\"><span class=\"SubHeadText\">Enter your product review below:</span></td></tr>");
    if (review_settings.use_ratings)
    {
        //draw the ratings input if ratings are enabled
        document.write ("<tr valign=top><td class=\"tablebgcolor\">Product Rating</td><td class=\"tablebgcolor\">");
        for (i=0;i<review_scale.scale_item_count;i++)
        {
            document.write("<input type=radio name=post_rating id=post_rating value="+(i+1)+">");
            if (review_scale.scale_items[i].item_image != "")
            {
                document.write ("<img src=\"" + review_scale.scale_items[i].item_image + "\" border=0 align=top alt=\"\" />");
            }else if (review_scale.image_path != "")
            {
                for (j=0;j<=i;j++)
                {
                    document.write ("<img src=\"" + review_scale.image_path + "\" border=0 align=top alt=\"\" />");
                }
            }
            document.write(review_scale.scale_items[i].display_text + "<br>");
        }
        document.write("</td></tr>");
    }


    for (i=1;i<=10;i++)
    {
        if (eval("review_labels.field_label"+i) != "")
        {
            document.write("<tr valign=\"top\"><td nowrap class=\"tablebgcolor\">" + eval("review_labels.field_label"+i) + "</td><td nowrap class=\"tablebgcolor\">");
            document.write("<input type=text name=\"post_value" + i + "\" id=\"post_value" + i + "\" size=50 /></td></tr>");
        }else{
            document.write("<input type=hidden name=\"post_value" + i + "\" id=\"post_value" + i + "\" />");
        }
    }
    document.write("<tr valign=\"top\"><td nowrap class=\"tablebgcolor\">" + review_labels.subject_label + "</td><td nowrap class=\"tablebgcolor\">");
    document.write("<input type=text name=\"post_subject\" id=\"post_subject\" size=50 maxlength=100 /></td></tr>");

    document.write("<tr><td colspan=\"2\" height=\"6\" class=\"tablebgcolor\">&nbsp;</td></tr>");
    document.write("<tr valign=\"top\"><td nowrap class=\"tablebgcolor\">First Name</td><td nowrap class=\"tablebgcolor\">");
    document.write("<input type=text name=\"firstname\" id=\"firstname\" size=50 maxlength=50 /></td></tr>");
    document.write("<tr valign=\"top\"><td nowrap class=\"tablebgcolor\">Last Name</td><td nowrap class=\"tablebgcolor\">");
    document.write("<input type=text name=\"lastname\" id=\"lastname\" size=50 maxlength=50 /></td></tr>");
    document.write("<tr valign=\"top\"><td nowrap class=\"tablebgcolor\">Email Address</td><td nowrap class=\"tablebgcolor\">");
    document.write("<input type=text name=\"email_address\" id=\"email_address\" size=50 maxlength=100 /></td></tr>");
    document.write("<tr valign=\"top\"><td nowrap class=\"tablebgcolor\">Display Name</td><td nowrap class=\"tablebgcolor\">");
    document.write("<input type=text name=\"display_name\" id=\"display_name\" size=50 maxlength=100 /></td></tr>");
    document.write("<tr valign=\"top\"><td nowrap class=\"tablebgcolor\">Show Display Name?</td><td nowrap class=\"tablebgcolor\">");
    document.write("<input type=radio name=\"show_name\" id=\"show_name\" value=1 checked />Yes &nbsp; <input type=radio name=\"show_name\" id=\"show_name\" value=0 />No </td></tr>");
    document.write("<tr valign=\"top\"><td nowrap class=\"tablebgcolor\">Show Email Address?</td><td nowrap class=\"tablebgcolor\">");
    document.write("<input type=radio name=\"show_email\" id=\"show_email\" value=1 checked />Yes &nbsp; <input type=radio name=\"show_email\" id=\"show_email\" value=0 />No </td></tr>");

    document.write("<tr><td colspan=\"2\" height=\"6\" class=\"tablebgcolor\" align=center><input type=submit value=\"Submit Review\"></td></tr>");
    document.write("<tr><td colspan=\"2\" height=\"6\" class=\"tablebgcolor\">&nbsp;</td></tr>");
    document.write("</table>");
}

function draw_rev_spanner()
{
    if (typeof currPage != "undefined" && typeof numPages != "undefined")
    {
        if (numPages > 1)
        {
            document.write ("&nbsp;&nbsp;&nbsp;<span class=PageSpanner id=SpannerLinks>View More:&nbsp;");
            if (currPage != 1)
            {
                document.write ("<a href=\"product_reviews.asp\" onclick=\"return(visitargs('product_reviews.asp','pf_id=" + pf_id + "&dept_id=" + dept_id + "&currPage=" + (currPage-1) + "','URL'));\">&lt;</a>&nbsp;");
            }
            for (i=1;i<=numPages;i++)
            {
                if (i != currPage)
                {
                    document.write ("&nbsp;<a href=\"product_reviews.asp\" onclick=\"return(visitargs('product_reviews.asp','pf_id=" + pf_id + "&dept_id=" + dept_id + "&currPage=" + i + "','URL'));\">" + i + "</a>");
                }else{
                    document.write ("&nbsp;" + i);
                }
            }
            if (numPages > currPage)
            {
                document.write ("&nbsp;&nbsp;<a href=\"product_reviews.asp\" onclick=\"return(visitargs('product_reviews.asp','pf_id=" + pf_id + "&dept_id=" + dept_id + "&currPage=" + (currPage+1) + "','URL'));\">&gt;</a>");
            }
        }
    }
}

function draw_image_2(){
	 if (product_image[1].scr=="PRODUCT" && product_image[1].image!="" ) {
		if (product_image[1].image_show=="TARGET REG" || product_image[1].image_show=="TARGET" ){
			if (product_image[1].image_show=="TARGET REG"){
				if (user_guid==""){
					document.write("<A HREF=\"shopper_lookup.asp?target=" + product_image[1].target + "&\" onClick=return(visitargs('shopper_lookup.asp',\"target=" + product_image[1].target + "&\")); target=\"_top\" >");
				}else {
					document.write("<A HREF=\"" + product_image[1].target + "\" onClick=return(visitargs('" + product_image[1].target + "')); target=\"_top\" >");
				}
			}else {
				document.write("<a HREF=\"" + product_image[1].target + "\" target=\"_top\">");
			}
			document.write("<img name=\"mainimg\" id=\"mainimg\" ALIGN =" + product_image[1].align + " ");
			if (product_image[1].width!=""){document.write("WIDTH =" + product_image[1].width + " ");}
			document.write(" BORDER=0  VSPACE=5  HSPACE=5 ALT=\"" + product_image[1].alt_text + "\" ");
			document.write(" SRC=\"assets/product_images/" + product_image[1].image +"\"></a>");
		}else{
			document.write("<img name=\"mainimg\" id=\"mainimg\" ALIGN =\"" + product_image[1].align + "\" ");
			if (product_image[1].width!=""){document.write("WIDTH =" + product_image[1].width + " ");}
			document.write(" BORDER=0  VSPACE=5  HSPACE=5 ALT=\"" + product_image[1].alt_text + "\" ");
			document.write(" SRC=\"assets/product_images/" + product_image[1].image +"\">");
		}
	}
}



//--------------------------------
// Structures
//--------------------------------
function ProductReviews()
{
  this.average_rating
  this.first_review_date
  this.last_review_date
  this.review_count
  this.top_review_id
  this.top_review_text
  this.bottom_review_id
  this.bottom_review_text
  this.review_items
}

function ProductReviewItem()
{
  this.review_id
  this.review_date
  this.review_rating
  this.scale_item_id
  this.reviewer_name
  this.reviewer_email
  this.review_subject
  this.value1
  this.value2
  this.value3
  this.value3
  this.value4
  this.value5
  this.value6
  this.value7
  this.value8
  this.value9
  this.value10
}

function ShopperReviews()
{
  this.user_id
  this.display_name
  this.show_name
  this.show_email
  this.user_enabled
  this.first_review_date
  this.last_review_date
  this.post_count
  this.review_items
}

function ShopperReviewItem()
{
  this.review_id
  this.review_date
  this.pf_id
  this.product_name
  this.product_image
  this.review_rating
  this.rating_display_text
  this.review_subject
  this.review_text
  this.review_status
  this.scale_item_image
  this.scale_image
}

function ProductReviewSettings()
{
    this.admin_email
    this.abuse_email
    this.moderator_email
    this.purchase_required
    this.use_ratings
    this.default_field
    this.ratings_mode
}

function ProductReviewLabels()
{
    this.subject_label
    this.field_label1
    this.field_label2
    this.field_label3
    this.field_label4
    this.field_label5
    this.field_label6
    this.field_label7
    this.field_label8
    this.field_label9
    this.field_label10
}

function ProductReviewScale()
{
  this.scale_name
  this.image_path
  this.scale_item_count
  this.scale_items
}

function ProductReviewScaleItem()
{
  this.scale_item_id
  this.scale_value
  this.display_text
  this.item_image
}

function PImage()
{
	this.image
	this.image_show
	this.align
	this.width
	this.alt_text
	this.scr
	this.target
}

function searchable_attr_struct(){
	this.sku
	this.name
	this.value
}

