﻿<!--//--><![CDATA[//><!--
sfHover = function() {
    if (document.getElementById("nav-links") != null) { 
        var sfEls = document.getElementById("nav-links").getElementsByTagName("LI");
        for (var i=0; i<sfEls.length; i++) {
	        sfEls[i].onmouseover=function() {
		        this.className+=" sfhover";
	        }
	        sfEls[i].onmouseout=function() {
		        this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
	        }
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
//--><!]]>

<!--//--><![CDATA[//><!--
if (document.getElementById) // NS
    printMenu = document.getElementById("print-links");
else if (document.all) // IE
    printMenu = document.all["print-links"];

if (printMenu != null) {
    sfHover = function() {
	    var sfEls = document.getElementById("print-links").getElementsByTagName("LI");
	    for (var i=0; i<sfEls.length; i++) {
		    sfEls[i].onmouseover=function() {
			    this.className+=" sfhover";
		    }
		    sfEls[i].onmouseout=function() {
			    this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		    }
	    }
    }
    if (window.attachEvent) window.attachEvent("onload", sfHover);
}
//--><!]]>

/*function changeImage(img_id,img_src,new_img,img_name) {
	if (document.getElementById) // NS 
        target = document.getElementById(img_id);
    else if (document.all) // IE
        target = document.all[img_id];
    
    if (document.form1.hdnID.Value != null) {
		if (document.getElementById) // NS 
			prevTarget = document.getElementById(document.form1.hdnID.Value);
		else if (document.all) // IE
			prevTarget = document.all[document.form1.hdnID.Value];
		
		prevTarget.src = document.form1.hdnImage.Value;
    }
    
	target.src = new_img;
	document.form1.hdnID.Value = img_id;
	document.form1.hdnImage.Value = img_src;
	document.form1.hdnName.Value = img_name;
}

function changeNumber(num, img_id, name) {
	if (document.getElementById) { // NS 
        target = document.getElementById(img_id);
        id = document.getElementById('hdnId' + num);
        val = document.getElementById('hdnName' + num);
    }
    else if (document.all) { // IE
        target = document.all[img_id];
        id = document.all['hdnId1'];
        val = document.all['hdnName' + num];
    }
    
    if (id.Value != null) {
		if (document.getElementById) // NS 
			prevTarget = document.getElementById(id.Value);
		else if (document.all) // IE
			prevTarget = document.all[id.Value];
		
		if (num == 1)
			prevTarget.src = '/images/color/one.gif';
		else if (num == 2)
			prevTarget.src = '/images/color/two.gif';
		else
			prevTarget.src = '/images/color/three.gif';
    }
    
    if (num == 1)
		target.src = '/images/color/one_on.gif';
	else if (num == 2)
		target.src = '/images/color/two_on.gif';
	else
		target.src = '/images/color/three_on.gif';
	
	id.Value = img_id;
	val.Value = name;
}*/

function clearRadioButtons()
{
	form = document.forms[0];
	
	for (i = 0; i < document.forms[0].length; i++) {
	    if (form.elements[i].type == 'radio')
	        form.elements[i].checked = false;
	}
}

function checkWeight(profile)
{
    if (document.getElementById) // NS
    {
        if (profile == "women")
            weight = document.getElementById("ctl00_ContentPlaceHolder1_Question!13");
        else
            weight = document.getElementById("ctl00_ContentPlaceHolder1_Question!96");
    }
    else if (document.all) // IE
    {
        if (profile == "women")
            weight = document.all["ctl00_ContentPlaceHolder1_Question!13"];
        else
            weight = document.all["ctl00_ContentPlaceHolder1_Question!96"];
    }
        
    if (weight.value == '') {
        alert('请填写您的体重！');
        return false;
        }
    else {
        if (isNaN(weight.value)) {
            alert('体重必须为数字！');
            return false;
            }
        else {
            return true;
            }
        }
}

function checkBodyline(profile)
{
    if (profile == "women")
    {
        if (document.getElementById) { // NS
            pBodyline = document.getElementById("Question_27");
            sBodyline = document.getElementById("Question_271");
            }
        else if (document.all) { // IE
            pBodyline = document.all["Question_27"];
            sBodyline = document.all["Question_271"];
            }
        
        if (pBodyline.checked | sBodyline.checked) {
            return true;
            }
        else {
            alert('您必须选择一种形体类型进行查看！');
            return false;
            }
    }
    else
    {
        if (document.getElementById) { // NS
            bodyline1 = document.getElementById("Question_1081");
            bodyline2 = document.getElementById("Question_1082");
            bodyline3 = document.getElementById("Question_1083");
            }
        else if (document.all) { // IE
            bodyline1 = document.all["Question_1081"];
            bodyline2 = document.all["Question_1082"];
            bodyline3 = document.all["Question_1083"];
            }
        
        if (bodyline1.checked | bodyline2.checked | bodyline3.checked) {
            return true;
            }
        else {
            alert('您必须选择一种形体类型进行查看！');
            return false;
            }
    }
}

function checkColor(profile)
{
    if (profile == "women")
    {
        if (document.getElementById) { // NS
            pColor = document.getElementById("Question_11p");
            sColor = document.getElementById("Question_11s");
            }
        else if (document.all) { // IE
            pColor = document.all["Question_11p"];
            sColor = document.all["Question_11s"];
            }
        
        if (pColor.checked | sColor.checked) {
            return true;
            }
        else {
            alert('您必须选择一种色彩类型进行查看！');
            return false;
            }
    }
    else
    {
        if (document.getElementById) { // NS
            pColor = document.getElementById("Question_216p");
            sColor = document.getElementById("Question_216s");
            }
        else if (document.all) { // IE
            pColor = document.all["Question_216p"];
            sColor = document.all["Question_216s"];
            }
        
        if (pColor.checked | sColor.checked) {
            return true;
            }
        else {
            alert('您必须选择一种色彩类型进行查看！');
            return false;
            }
    }
}

function DisplayPromoCode()
{
    if (document.getElementById) // NS
        target = document.getElementById('ctl00_ContentPlaceHolder1_radSelection_0');
    else if (document.all) // IE
        target = document.all['ctl00_ContentPlaceHolder1_radSelection_0'];
        
    if (target.checked)
        showSection('divPromoCode', 'show');
    else
        showSection('divPromoCode', 'hide');
}

function loadVideo(video, title)
{
    frames['player'].location.href = "videos/videoPlayer.html?v=" + video + "&t=" + title;
}

// This function sets the hidden value for the corresponding question
function SetHiddenValue(checkboxname, hiddenfieldname)
{
    if (document.getElementById) { // NS
        source = document.getElementById(checkboxname);
        target = document.getElementById(hiddenfieldname);
    }
    else if (document.all) { // IE
        source = document.all[checkboxname];
        target = document.all[hiddenfieldname];
    }
    
	// Set the value, or erase it if unchecking box
	if (source.checked)
		target.value = source.value;
	else
		target.value = "";
}

function openWindow(url, width, height, properties) 
{
	var props;
	
	if (properties == '')
		props = "resizable=no,scrollbars=no,menubar=no,status=no,toolbar=no,location=no";
	else
		props = properties;
		
	var win = window.open(url, 'window', 'width=' + width + ',height=' + height + ',' + properties);
}

function showSection(element, action)
{
    if (document.getElementById) // NS
        target = document.getElementById(element);
    else if (document.all) // IE
        target = document.all[element];
        
    if (action == "show")
		target.style.display = "";
	else
		target.style.display = "none";
}

function showHide(element)
{
    if (document.getElementById) // NS
        target = document.getElementById(element);
    else if (document.all) // IE
        target = document.all[element];

    if (target)
    {
        if( target.style.display == "none" )
            target.style.display = "";
        else
            target.style.display = "none";
    }
}

/*function showEyes(element)
{
	if (document.getElementById) { // NS
        row1 = document.getElementById('row1');
        row2 = document.getElementById('row2');
        row3 = document.getElementById('row3');
        target = document.getElementById(element);
    }
    else if (document.all) { // IE
        row1 = document.all['row1'];
        row2 = document.all['row2'];
        row3 = document.all['row3'];
        target = document.all[element];
    }
    
    row1.style.display = "none";
    row2.style.display = "none";
    row3.style.display = "none";
    
    target.style.display = "";
}

function showHair(element)
{
	if (document.getElementById) { // NS
        row1 = document.getElementById('row1');
        row2 = document.getElementById('row2');
        row3 = document.getElementById('row3');
        row4 = document.getElementById('row4');
        target = document.getElementById(element);
    }
    else if (document.all) { // IE
        row1 = document.all['row1'];
        row2 = document.all['row2'];
        row3 = document.all['row3'];
        row4 = document.all['row4'];
        target = document.all[element];
    }
    
    row1.style.display = "none";
    row2.style.display = "none";
    row3.style.display = "none";
    row4.style.display = "none";
    
    target.style.display = "";
}

function showSkin(element)
{
	if (document.getElementById) { // NS
        set1 = document.getElementById('set1');
        set2 = document.getElementById('set1');
        target = document.getElementById(element);
    }
    else if (document.all) { // IE
        set1 = document.all['set1'];
        set2 = document.all['set1'];
        target = document.all[element];
    }
    
    set1.style.display = "none";
    set2.style.display = "none";
    
    target.style.display = "";
}*/

/****************************************************************
*	Name: isDefined
*	Purpose: determines if a variable is defined or not
*	Attributes:
*		-->variable: STRING with the name of the variable to check
*		<--return: BOOLEAN value
****************************************************************/
function isDefined(variable)
{
	return (typeof(variable) == "undefined") ? false : true;
}

/****************************************************************
*	Name: getQuerystringValue
*	Purpose: gets a value from the querystring
*	Attributes:
*		-->arg: STRING with the name of the variable to get
*		<--return: a STRING of the value or NULL
****************************************************************/
function getQuerystringValue(arg)
{
	var queryString = location.search;
	if ( queryString.indexOf(arg) >= 0 )
	{
		var position = queryString.indexOf(arg + "=") + arg.length + 1;
		if ( queryString.indexOf("&", position) >= 0 )
			return queryString.substring(position, queryString.indexOf("&", position));
		else
			return queryString.substring(position, queryString.length);
	}
	else
	{
		return null;
	}
}