var ServerName = window.location.host;
var Protocol = location.protocol.slice(0, -1);
function setPreviewState(inState)
{
PreviewState = inState;
}
function setServerName(inName)
{
ServerName = inName;
}
function getStyle(inName)
{
if(inName.charAt(0) != ".")
{
inName = "." + inName;
}
var style = getStyleBySelector(inName);
return style;
}
function getStyleBySelector(inName)
{
for(var j = 0; j < document.styleSheets.length; j++)
{
var rules = document.styleSheets[j].rules;
if(!rules)
{
rules = document.styleSheets[j].cssRules;
}
for(var i = 0; i < rules.length; i++)
{
var selector = rules[i].selectorText.toLowerCase();
if(selector.charAt(0) == '*')
{
selector = selector.substring(1);
}
if(selector == inName.toLowerCase())
{
return rules[i].style;
}
}
}
}
function getStyleAttribute(inName, inAttribute)
{
var style = getStyle(inName);
if(style)
{
return(style[inAttribute]);
}
}
function setStyleAttribute(inName, inAttribute, inValue)
{
var style = getStyle(inName);
if(style)
{
style[inAttribute] = inValue;
}
}
var HexValues = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F");
function hexToInt(inHex)
{
if((inHex >= 0) && (inHex <= 9))
{
return inHex * 1;
}
switch(inHex.toUpperCase())
{
case "A": return 10;
case "B": return 11;
case "C": return 12;
case "D": return 13;
case "E": return 14;
case "F": return 15;
default: return 'X';
}
}
function prepareColor(inValue)
{
if(inValue.indexOf("#") == 0)
{
inValue = inValue.substring(1);
}
else if(inValue.indexOf("rgb") >= 0)
{
var parts = inValue.substring(4, inValue.length - 1).split(",");
inValue = HexValues[Math.floor(parts[0] / 16)];
inValue += HexValues[parts[0] % 16];
inValue += HexValues[Math.floor(parts[1] / 16)];
inValue += HexValues[parts[1] % 16];
inValue += HexValues[Math.floor(parts[2] / 16)];
inValue += HexValues[parts[2] % 16];
}
return inValue;
}
function prepareFontSize(inValue)
{
var position = inValue.indexOf("px");
if(position > 0)
{
return inValue.substring(0, position);
}
position = inValue.indexOf("pt");
if(position > 0)
{
return inValue.substring(0, position);
}
return inValue;
}
function prepareURL(inURL)
{
if(inURL.substr(0,4) == "http")
{
return inURL;
}
if((PreviewState == "preview") && (inURL.substr(0,9) == "/members/"))
{
inURL = "/preview" + inURL;
}
inURL = Protocol + "://" + ServerName + inURL;
return inURL;
}
function shadeColor(inColor, inAdjustment)
{
if(!inColor)
{
return "ffffff";
}
if(inColor.length != 6)
{
return inColor
}
var red = 0;
var green = 0;
var blue = 0;
red += hexToInt(inColor.charAt(0)) * 16;
red += hexToInt(inColor.charAt(1));
green += hexToInt(inColor.charAt(2)) * 16;
green += hexToInt(inColor.charAt(3));
blue += hexToInt(inColor.charAt(4)) * 16;
blue += hexToInt(inColor.charAt(5));
if(inAdjustment < 0)
{
inAdjustment = 0;
}
else if(inAdjustment > 1)
{
inAdjustment = 1;
}
var offset = ((red + green + blue) / 3 < 127) ? (inAdjustment * 255) : 0;
red = Math.floor((red * (1.0 - inAdjustment)) + offset);
green = Math.floor((green * (1.0 - inAdjustment)) + offset);
blue = Math.floor((blue * (1.0 - inAdjustment)) + offset);
inColor = HexValues[Math.floor(red / 16)];
inColor += HexValues[red % 16];
inColor += HexValues[Math.floor(green / 16)];
inColor += HexValues[green % 16];
inColor += HexValues[Math.floor(blue / 16)];
inColor += HexValues[blue % 16];
return inColor;
}
function darkerColor(inColor, inAdjustment)
{
if(!inColor)
{
return "ffffff";
}
if(inColor.length != 6)
{
return inColor
}
var red = 0;
var green = 0;
var blue = 0;
red += hexToInt(inColor.charAt(0)) * 16;
red += hexToInt(inColor.charAt(1));
green += hexToInt(inColor.charAt(2)) * 16;
green += hexToInt(inColor.charAt(3));
blue += hexToInt(inColor.charAt(4)) * 16;
blue += hexToInt(inColor.charAt(5));
if(inAdjustment < 0)
{
inAdjustment = 0;
}
else if(inAdjustment > 1)
{
inAdjustment = 1;
}
red = Math.floor((red * (1.0 - inAdjustment)));
green = Math.floor((green * (1.0 - inAdjustment)));
blue = Math.floor((blue * (1.0 - inAdjustment)));
inColor = HexValues[Math.floor(red / 16)];
inColor += HexValues[red % 16];
inColor += HexValues[Math.floor(green / 16)];
inColor += HexValues[green % 16];
inColor += HexValues[Math.floor(blue / 16)];
inColor += HexValues[blue % 16];
return inColor;
}
function lighterColor(inColor, inAdjustment)
{
if(!inColor)
{
return "ffffff";
}
if(inColor.length != 6)
{
return inColor
}
var red = 0;
var green = 0;
var blue = 0;
red += hexToInt(inColor.charAt(0)) * 16;
red += hexToInt(inColor.charAt(1));
green += hexToInt(inColor.charAt(2)) * 16;
green += hexToInt(inColor.charAt(3));
blue += hexToInt(inColor.charAt(4)) * 16;
blue += hexToInt(inColor.charAt(5));
if(inAdjustment < 0)
{
inAdjustment = 0;
}
else if(inAdjustment > 1)
{
inAdjustment = 1;
}
var offset = inAdjustment * 255;
red = Math.floor((red * (1.0 - inAdjustment)) + offset);
green = Math.floor((green * (1.0 - inAdjustment)) + offset);
blue = Math.floor((blue * (1.0 - inAdjustment)) + offset);
inColor = HexValues[Math.floor(red / 16)];
inColor += HexValues[red % 16];
inColor += HexValues[Math.floor(green / 16)];
inColor += HexValues[green % 16];
inColor += HexValues[Math.floor(blue / 16)];
inColor += HexValues[blue % 16];
return inColor;
}
function getImageURL(inTemplateURL, inAttributes)
{
output = prepareURL(inTemplateURL);
if(inAttributes)
{
output += "?"
output += inAttributes;
}
return output;
}
function drawImage(inTemplateURL, inAttributes, inExtra)
{
document.write("
");
}
function drawInputImage(inTemplateURL, inAttributes, inName, inExtra)
{
document.write("");
}
function resizeImage(inURL, inWidth, inHeight, inExtra, inAttributes, inTemplateURL)
{
if(!inTemplateURL)
{
inTemplateURL = "/images/site/common/en/image/imagewrap.img";
}
var attributes = "picture.image.url=" + prepareURL(inURL);
if(inWidth)
{
attributes += "&picture.width.max=" + inWidth
}
if(inHeight)
{
attributes += "&picture.height.max=" + inHeight
}
if(inAttributes)
{
attributes += inAttributes;
}
drawImage(inTemplateURL, attributes, inExtra);
}
function colorizeImage(inURL, inColor, inExtra, inAttributes, inTemplateURL)
{
if(!inTemplateURL)
{
inTemplateURL = "/images/site/common/en/image/colorize.img";
}
var attributes = "picture.image.url=" + prepareURL(inURL);
if(inColor)
{
attributes += "&picture.image.colorize.color=" + prepareColor(inColor)
}
if(inAttributes)
{
attributes += "&" + inAttributes;
}
drawImage(inTemplateURL, attributes, inExtra);
}
function colorizeStyleImage(inURL, inColor, inAttributes, inTemplateURL)
{
if(!inTemplateURL)
{
inTemplateURL = "/images/site/common/en/image/colorize.img";
}
var attributes = "picture.image.url=" + prepareURL(inURL);
if(inColor)
{
attributes += "&picture.image.colorize.color=" + prepareColor(inColor)
}
if(inAttributes)
{
attributes += "&" + inAttributes;
}
return "url(" + inTemplateURL + "?" + attributes + ")";
}
// ---------------------------------
// Elements
function drawImageElement(inURL, inName, inAlignment, inWidth, inHeight, inExtra, inAttributes, inTemplateURL)
{
var extra = inExtra;
if(inName)
{
var inNameA = unescape(inName);
var inNameB = inNameA.replace(/\"/g,"");
extra += (" alt=\"" + inNameB + "\"");
}
if(inAlignment == "center")
{
document.write("
");
}
else if(inAlignment == "left")
{
extra += " align=left";
}
else if(inAlignment == "right")
{
extra += " align=right";
}
resizeImage(inURL, inWidth, inHeight, extra, inAttributes, inTemplateURL);
if(inAlignment == "center")
{
document.write("");
}
}
// ---------------------------------
// Tabs
var Tabs = new Array();
var TabCounter = 0;
function Tab(inLabel, inLink, inContext, inSelected)
{
this.Label = inLabel;
this.Link = inLink;
this.Context = inContext;
this.Selected = inSelected;
this.Alternative = false;
}
function clearTabs()
{
Tabs = new Array();
}
function addTab(inLabel, inLink, inContext, inSelected)
{
Tabs[Tabs.length] = new Tab(inLabel, inLink, inContext, inSelected);
}
function drawTabs(inOrientation, inWrapNumber, inWidth, inExtra, inAttributes, inTemplateURL)
{
if(Tabs.length == 0)
{
return;
}
if(inOrientation == "horizontal")
{
document.write("");
document.write("");
for(var i = 0; i < Tabs.length; i++)
{
Tabs[i].Context = Tabs[i].Context.toLowerCase();
if((i % inWrapNumber) == 0)
{
Tabs[i].Context = 'n' + Tabs[i].Context.slice(1);
}
else if((i % inWrapNumber) == (inWrapNumber - 1))
{
Tabs[i].Context = Tabs[i].Context.slice(0, 2) + 'n';
}
var attributes = inAttributes;
if((i / inWrapNumber) > 0)
{
attributes += "&style=alternate";
}
document.write("| ");
drawTab(Tabs[i], inExtra, inAttributes, inTemplateURL);
document.write(" | ");
if(((i % inWrapNumber) == (inWrapNumber - 1)) && (i < (Tabs.length - 1)))
{
document.write("
");
}
}
document.write("
");
document.write("
");
}
else
{
for(var i = 0; i < Tabs.length; i++)
{
if(i > 0)
{
document.write("
");
}
drawTab(Tabs[i], inExtra, inAttributes, inTemplateURL);
}
}
}
function drawTab(inTab, inExtra, inAttributes, inTemplateURL)
{
var imageName = "tab" + (TabCounter++);
var imageURL = prepareURL(inTemplateURL);
imageURL += "?label.text=" + inTab.Label;
imageURL += "&tab.context=" + inTab.Context;
if(inAttributes)
{
imageURL += "&";
imageURL += inAttributes;
}
imageURL += "&state=";
if(inTab.Selected == "true")
{
imageURL += "selected";
}
var mouseOut = "document.images." + imageName + ".src=\"" + imageURL + "\"";
var mouseOver = "document.images." + imageName + ".src=\"" + imageURL + "over" + "\"";
if(!inExtra)
{
inExtra = "";
}
newAlt = unescape(inTab.Label);
newAlt2 = newAlt.replace(/\"/g,"");
inExtra += " alt=\"" + newAlt2 + "\"";
document.write("");
document.write("
");
document.write("");
}
// ---------------------------------
// Buttons
function drawButton(inLinkURL, inLabel, inTemplateURL, inAttributes)
{
}
// ---------------------------------
// Header
function drawHeader(inImageDrawn, inExtra, inAttributes, inTemplateURL)
{
var title = unescape(headerName + "\n" + headerByline + "\n" + headerText);
var attributes = "";
if(headerLayout == "2") // imageonly
{
attributes += "&name.visible=false&byline.visible=false&text.visible=false&state=imageonly";
if(headerImage)
{
attributes += "&logo.image.url=";
attributes += prepareURL(headerImage);
}
else
{
return;
}
}
else
{
if(headerName)
{
attributes += "&name.text=";
attributes += headerName;
}
else
{
attributes += "&name.visible=false";
}
if(headerByline)
{
attributes += "&byline.text=";
attributes += headerByline;
}
else
{
attributes += "&byline.visible=false";
}
if(headerText)
{
attributes += "&text.text=";
attributes += headerText;
}
else
{
attributes += "&text.visible=false";
}
if(inImageDrawn == false)
{
if(headerImage)
{
attributes += "&logo.image.url=";
attributes += prepareURL(headerImage);
}
else
{
attributes += "&logo.visible=false";
}
}
else
{
attributes += "&logo.visible=false";
}
if(headerLayout)
{
attributes += "&header.import.file=/site/common/en/header/layout";
attributes += headerLayoutID;
attributes += ".txt";
attributes += "&logo.import.file=/site/common/en/header/logo";
attributes += headerLogoID;
attributes += ".txt";
}
}
if(inAttributes)
{
attributes += "&";
attributes += inAttributes;
}
if(attributes.charAt(0) == "&")
{
attributes = attributes.substring(1);
}
if(!inTemplateURL)
{
inTemplateURL = "/images/site/common/en/header/header.img";
}
if(!inExtra)
{
inExtra = "";
}
var newTitle = title.replace(/\"/g,"");
inExtra += " alt=\"" + newTitle + "\"";
drawImage(inTemplateURL, attributes, inExtra);
}
// ---------------------------------
// Borders
var borderWidth = "";
var borderAttributes = "";
var borderTemplateURL = "";
function drawBorderStart(inWidth, inAttributes, inTemplateURL, inCellAlign)
{
borderWidth = inWidth;
borderAttributes = inAttributes;
borderTemplateURL = inTemplateURL;
if(!borderTemplateURL)
{
borderTemplateURL = "/images/site/common/en/image/border.img";
}
// ---------------
attributes = "state=top";
attributes += "&width=" + borderWidth;
if(borderAttributes)
{
attributes += "&";
attributes += borderAttributes;
}
document.write("| ");
drawImage(borderTemplateURL, attributes);
document.write(" |
");
// ---------------
attributes = "state=left";
attributes += "&width=" + borderWidth;
if(borderAttributes)
{
attributes += "&";
attributes += borderAttributes;
}
document.write("| ");
drawImage(borderTemplateURL, attributes);
document.write(" | ");
}
function drawBorderEnd()
{
attributes = "state=right";
attributes += "&width=" + borderWidth;
if(borderAttributes)
{
attributes += "&";
attributes += borderAttributes;
}
document.write(" | ");
drawImage(borderTemplateURL, attributes);
document.write(" |
");
// ---------------
attributes = "state=bottom";
attributes += "&width=" + borderWidth;
if(borderAttributes)
{
attributes += "&";
attributes += borderAttributes;
}
document.write("| ");
drawImage(borderTemplateURL, attributes);
document.write(" |
");
}
// ---------------------------------
// Misc.
function pressButton(inName)
{
myForm = document.forms[0];
myForm.ACTION.name = inName;
myForm.submit();
}
function drawBrowseMenu(inDropBox, inWidth, inMaxOptionLength)
{
if((inDropBox == '') || (inMaxOptionLength == '') || (inWidth == ''))
{
return;
}
inWidth = Number(inWidth);
if(!inMaxOptionLength)
{
inMaxOptionLength = 0;
}
else
{
inMaxOptionLength = Number(inMaxOptionLength);
}
inDropBox = unescape(inDropBox);
inDropBox = inDropBox.slice(inDropBox.indexOf(">") + 1);
inDropBox = inDropBox.slice(0, inDropBox.indexOf(""));
menuOptions = inDropBox.split("");
inDropBox = '";
document.write(inDropBox);
}
function drawFormTag(inProtocol, inServer, inPreview, inEntryPage)
{
document.write("