// (c) Eonic Ltd 2002-9
// Authority: Trevor Spink

var obj = null;

$(document).ready(function() {
    matchHeightCol($(".cols2 .listItem"), '2');
    matchHeightCol($(".cols3 .listItem"), '3');
    $('a.lightbox').lightBox();
    /*Change Price on Selected SKU Option - this function uses 'Live' to cater for content inserted via ajax*/
    $('.skuOptions').live('change', function() {
        obj = this;
        var skuElement = obj.value.split('_');
        var skuId = skuElement[0];
        var rrp = skuElement[1];
        var salePrice = skuElement[2];

        var skuId = 'qty_' + skuId;
        var priceId = '#price_' + skuElement[3];
        var pictureId = '#picture_' + skuElement[0]

        if (skuId != '') {
            $('.qtybox')
            .attr('name', skuId)
            .attr('id', skuId)
        }

        if (rrp != '') {
            $('#productRRP')
            .html(rrp);
        }

        if (salePrice != '') {
            $('#productPrice')
            .html(salePrice);
        }
        if ($('.product .picture').length > 1) {
            $('.product .picture').addClass('hidden');
            $(pictureId).parents('span.picture').removeClass('hidden');
        }


    });
});

$.fn.prepareEditable = function() {
    
     $('.editable').hover(function() {
         if (obj) {
            obj.find('.inlinePopupOptions').hide('fast');
            obj = null;
         } //if
         $(this).find('.inlinePopupOptions').show('fast');
      }, function() {
         obj = $(this);
         setTimeout(
            "editableCheckHover()",
            400);
      });   
};

function editableCheckHover() {
   if (obj) {
       obj.find('.inlinePopupOptions').hide('fast');
   };
};




$(function() {
    // target _blank workaround - added Robw 23/2/10
    $('a[rel*=external]').click(function() {
        window.open(this.href);
        return false;
    });
});




/*
 ---------------------- Handle Eonic Xforms-------------------------
*/
$.fn.prepareXform = function() {

    //----------------------Tiny MCE----------------------------

    $('textarea.xhtml').tinymce({
        // Location of TinyMCE script
        script_url: '/ewcommon/js/tinymce/tiny_mce.js',

        theme: "advanced",
        mode: "exact",
        width: "625",
        relative_urls: false,
        plugins: "table,contextmenu,paste,iespell,media,visualchars,searchreplace,xhtmlxtras,safari",
        entity_enconding: "numeric",
        convert_fonts_to_spans: true,
        gecko_spellcheck: true,
        theme_advanced_buttons1: "cut, copy, paste,pastetext,pasteword,selectall,search, replace, separator,undo,redo,separator,removeformat,cleanup,separator,formatselect,separator,bold, italic, underline,strikethrough,separator,justifyleft, justifycenter, justifyright, justifyfull,",
        theme_advanced_buttons2: "tablecontrols,separator,bullist, numlist, outdent, indent,hr,separator,link, unlink, image, media, visualchars, separator,code,help",
        theme_advanced_buttons3: "",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        paste_create_paragraphs: false,
        paste_use_dialog: true,
        auto_cleanup_word: "true",
        valid_elements: "a[href|target|title|style|class|onmouseover|onmouseout|onclick],"
				            + "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style],"
				            + "table[cellspacing|cellpadding|border|height|width|style|class],"
				            + "p[align|style|class],"
				            + "span[class],"
				            + "form[action|method|name|style|class],object[*],param[*],embed[*],"
				            + "input[type|value|name|style|class|src|alt|border|size],"
				            + "textarea[type|value|name|style|class|src|alt|border|size|cols|rows],"
				            + "td/th[colspan|rowspan|align|valign|style|class],"
				            + "h1[style|class],h2[style|class],h3[style|class],h4[style|class],h5[style|class],h6[style|class],ol[style|class],ul[style|class],li[style|class],div[align|style|class],span[style|class],thead[style|class],tbody[style|class],tr[class],dd[style|class],dl[style|class],dt[style|class],sup,sub,pre,address,strong,b,em,i,u,s,hr,blockquote,br"
    });


    //---------------------- Datepicker ----------------------------

    if ($('input.jqDatePicker').length > 0) {
        $.datepicker.setDefaults($.datepicker.regional['']);

        $('input.jqDatePicker').each(function(i) {

            $(this).datepicker({
                closeAtTop: false,
                closeText: 'Close Calendar',
                clearText: 'Clear Date',
                showOn: "both",
                buttonImage: "/ewcommon/images/icons/calendar.gif",
                buttonImageOnly: true,
                dateFormat: 'd M yy',
                altField: '#' + $(this).attr('id').replace('-alt', ''),
                altFormat: 'yy-mm-dd',
                mandatory: $(this).hasClass('required')
            });
        });
    };
    //---------------------- Slider ----------------------------
  
    $('div.slider').slider({
        range: 'min',
        value: parseInt($('div.slider').children('span.val').text()),
        min: parseInt($('div.slider').children('span.min').text()),
        max: parseInt($('div.slider').children('span.max').text()),
        step: parseInt($('div.slider').children('span.step').text()),
        slide: function(event, ui) {
            $("#" + $(this).children('span.ref').text()).val(ui.value);
        }
    });

    //----------------------Colourpicker----------------------------
    $('input.colorPicker').gccolor();
};




/*  USED IN ALL EW:xFORMS - For when an Radio Button Toggles a switch /case */
function showDependant(dependant, allDependants) {

    // Hide unwanted Dependants
    $("." + allDependants).addClass('hidden');
    
    // Make required inactive to avoid JS validation
    $("." + allDependants).find('.required').each(function() {
        $(this).removeClass('required');
        $(this).addClass('required~inactive')
    })
    
    // Make all now hidden fields inactive so values are lost when submitted.
    $("." + allDependants).find(":input").not(':submit').each(function() {
        var fieldName = $(this).attr('name');
        var tempFieldName = fieldName + '~inactive';
        $(this).attr('name', tempFieldName);
    });


    // Show wanted Dependants
    $("#" + dependant).removeClass('hidden');
    
    // Find all inactive required fields and make required again for JS Validation
    $("." + dependant).find('.required~inactive').each(function() {
        $(this).addClass('required');
        $(this).removeClass('required~inactive');
    })
    
    // Find all inactive inputs, and re-activate,
    $("#" + dependant).find(":input").not(':submit').each(function() {
        var fieldName = $(this).attr('name');
        var tempFieldName = fieldName.replace(/~inactive/gi, ''); /* g-  required for global replace, i - required for case-insesitivity */
        $(this).attr('name', tempFieldName);
        $(this).attr('id', tempFieldName);
    });
}


/*  USED IN ALL EW:xFORMS - To re-enable radio button functionality when renaming a radio button */
function psuedoRadioButtonControl(sBindName, sBindToName, sBindToValue) {

    $("input[id^='" + sBindName + "']").click(function() {

        // Remove all checked
        $("input[id^='" + sBindName + "']").attr('checked', '');

        // Make selected checked
        $(this).attr('checked', 'checked');

        // If Pseudo radio clicked
        if ($(this).val() == sBindToValue) {

            // Assign value to hidden field
            $("input[name='" + sBindToName + "'][type='hidden']").val(sBindToValue);

            // Make pseudo input inactive, to avoid CSL with hidden input 
            var fieldName = $(this).attr('name');
            var tempFieldName = fieldName + '~inactive';
            $(this).attr('name', tempFieldName);

        }

        // Else not Pseudo radio
        else {

            // Empty Hidden field
            $("input[name='" + sBindToName + "'][type='hidden']").val('');
            
            // re-activate pseudo radio
            var fieldName = $("input[name^='" + sBindToName + "']").attr('name');
            var tempFieldName = fieldName.replace(/~inactive/gi, ''); /* g-  required for global replace, i - required for case-insesitivity */
            $("input[name^='" + sBindToName + "']").attr('name', tempFieldName);

        }

    });

};


function matchHeight(group) {
    var tallest = 0;
    group.each(function() {
        thisHeight = $(this).height();
        if (thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.each(function() {
        $(this).height(tallest);
    });
}

function matchHeightCol(group,rowCount) {
    var row = 0;
    var rowCounter = 1;
    group.each(function() {
        $(this).addClass('row' + row);
        if (rowCounter == rowCount) {
            matchHeight($('.row' + row))
            row = row + 1;
            rowCounter = 1;
        }
        else {
            rowCounter = rowCounter + 1;
            $(this).addClass('rowMargin');
        }
    });
}


// Common functions
var lockmenu = 0;
var menuNode;

function OpenWindow(theURL, winName, features) {
    //featureStr = 'toolbar=yes,scrollbars=yes,resize=yes,location=no,menubar=yes,width=700,height=560' 
    featureStr = features;
    // these lines make the pickImage facility work in firefox, every other time?? 
    // theURL = unescape(theURL);
    //theURL=theURL.replace('&amp;',/\&/g).replace('&amp;',/\&/g).replace('&amp;',/\&/g).replace('&amp;',/\&/g).replace('&amp;',/\&/g);

    opener = window.open(theURL, winName, featureStr);
    opener.focus();
}


function getChildUL(obj) {
	for (i=0; i<obj.childNodes.length; i++){
		child = obj.childNodes[i]
		if (child.className != null) {
			if (child.className.indexOf("inlinePopupLabel") >= 0){
				for (j=0; j<child.childNodes.length; j++){
					if (child.childNodes[j].nodeName=="UL") { return child.childNodes[j];break;}
				}
			}
		}
	}
}

function divSwitch(parentContainerId,activeId) {

	parentContainer = document.getElementById(parentContainerId)
	children = parentContainer.getElementsByTagName("div")
	activeId = document.getElementById(activeId)
	
	// hide all the children of the parent container
	for (var i = 0; i < children.length; i++) 
	{
	    if (children[i].id != 'imageDescription'){
		    children[i].style.display = "none";
		}
	}

	// show the activeId
	activeId.style.display = "block";
}

function gallerySwitch(imgName,imgSrc,nWidth,nHeight,cCaption){
	var img = document.images["pic"]
	var cap = document.getElementById("imgCaption")
	
	// Change the img
	img.src = imgSrc;
	img.width = nWidth
	img.height = nHeight
	
	// Change the caption
	// cap.firstChild.nodeValue = cCaption

}

function getAppVersion() {
	appname= navigator.appName;
	appversion = navigator.appVersion;
	majorver = appversion.substring(0, 1);
	if ( (appname == "Netscape") && ( majorver >= 3 ) ) return 1;
	if ( (appname == "Microsoft Internet Explorer") && (majorver >= 4) ) return 1;
	return 0;
}



function setHome(arg, urlName){
	
if(navigator.appVersion.charAt(navigator.appVersion.indexOf("MSIE") + 5) >= 5 && navigator.platform.indexOf("Win16") == -1 
 && navigator.platform.indexOf("Mac") == -1){
 		arg.style.behavior='url(#default#homepage)';
 		arg.setHomePage(urlName);
 		arg.href="#";
 		return true;
 	}
 	else {return false}
}

function makedate(formName,dateField){
	var dayval;
	
	if ("undefined" == typeof(document.forms[formName].elements['day_' + dateField])) {
		dayval = '01';
	} else {
		dayval = document.forms[formName].elements['day_' + dateField].value
	}
	document.forms[formName].elements[dateField].value = dayval + " " + document.forms[formName].elements['month_' + dateField].value + " " + document.forms[formName].elements['year_' + dateField].value;
}

function loaddate(formName,dateField){
   dateStr = document.forms[formName].elements[dateField].value
   dateArr = dateStr.split(" ",4)
   
    document.forms[formName].elements['day_' + dateField].value = dateArr[0]
    document.forms[formName].elements['month_' + dateField].value = dateArr[1]
    document.forms[formName].elements['year_' + dateField].value = dateArr[2]
    // alert(document.forms[formName].elements['month_' + dateField].selectedIndex)
}


// XML DATE VARIANTS
function makeXmlDate(formName,dateField){
	var f = document.forms[formName]
	var dayval;
	
	if ("undefined" == typeof(f.elements['day_' + dateField])) {
		dayval = '01';
	} else {
		dayval = f.elements['day_' + dateField].value
	}
	
	f.elements[dateField].value = f.elements['year_' + dateField].value + "-" + f.elements['month_' + dateField].value + "-" + dayval;
	//alert(f.elements[dateField].value)
}

function loadXmlDate(formName,dateField){
	var f = document.forms[formName]
		
   dateStr = f.elements[dateField].value
   dateArr = dateStr.split("-",4)
   
    f.elements['day_' + dateField].value = dateArr[2].substr(0,2)
    f.elements['month_' + dateField].value = dateArr[1]
    f.elements['year_' + dateField].value = dateArr[0]
    // alert(document.forms[formName].elements['month_' + dateField].selectedIndex)
}

function makedatemmyy(formName,dateField){
	document.forms[formName].elements[dateField].value = document.forms[formName].elements['month_' + dateField].value + " " + document.forms[formName].elements['year_' + dateField].value;
}

function loaddatemmyy(formName,dateField){
   dateStr = document.forms[formName].elements[dateField].value
   dateArr = dateStr.split(" ",4)
   
    document.forms[formName].elements['month_' + dateField].value = dateArr[0]
    document.forms[formName].elements['year_' + dateField].value = dateArr[1]
    // alert(document.forms[formName].elements['month_' + dateField].selectedIndex)
}
 

//define objects for the main list
function ListItem(nvalue,description){
        //function for defining the elements of the main list
        this.nvalue=nvalue;
        this.description=description;
}

//define objects for the dependent list
function ListSubItem(category,nvalue,description){
        //function for defining the elements of the sublists
        this.category=category;
        this.nvalue=nvalue;
        this.description=description;
}



function setEditableDropdown(editfield,formName,fieldName){
//show the selected values
        var lastIndex;
        lastIndex = document.forms[formName].elements[fieldName].options.length - 1;      
        document.forms[formName].elements[fieldName].options[lastIndex].selected=true;
        document.forms[formName].elements[fieldName][document.forms[formName].elements[fieldName].selectedIndex].value = editfield.value      
}


// Admin function for Shipping Options Valid Regions List
function checkShippingLocationsForm(oCurrent) {
	toggleShipLocList(oCurrent.parentNode, oCurrent.checked, true)
}

function toggleShipLocList(oLI, bChecked, bIsTopLevel) {
	
	var oChildren, oChild, oListChildren, i, j, bCheckbox
	
	// Check the children, if they exist
	oChildren = oLI.childNodes
	bCheckbox = false
	for(i=0;i<oChildren.length;i++){
		oChild = oChildren.item(i)
		if (oChild.nodeName == 'SPAN' && !bIsTopLevel) { (bChecked)?oChild.className = 'locationName locationDisabled':oChild.className = 'locationName' }		
		if (oChild.type == 'checkbox' && !bIsTopLevel) { oChild.disabled = bChecked; bCheckbox = oChild.checked;}
		if (oChild.nodeName == 'UL') { 
		    oListChildren = oChild.childNodes
		    for(j=0;j<oListChildren.length;j++){
				toggleShipLocList(oListChildren.item(j), (bChecked || bCheckbox), false)
			}
		}
	}
	
}

function setupShipLocUL(oUL) {
	var oChildren, oChild
	// Check the children LIs
	oChildren = oUL.childNodes
	for(i=0;i<oChildren.length;i++){
		oChild = oChildren.item(i)
		if (oChild.nodeName == 'LI') { setupShipLocList(oChild, false) }
	}
}

function setupShipLocList(oLI, bChecked) {
	
	var oChildren, oChild, oListChildren, i, j, bParCheck
	
	// Check the children, if they exist
	oChildren = oLI.childNodes
	bParCheck = bChecked
	for(i=0;i<oChildren.length;i++){
		oChild = oChildren.item(i)
		if (oChild.nodeName == 'SPAN') { (bChecked)?oChild.className = 'locationName locationDisabled':oChild.className = 'locationName' }		
		if (oChild.type == 'checkbox') { 
			oChild.disabled = bChecked; 
			if (!bParCheck) {bParCheck = oChild.checked}
		}
		if (oChild.nodeName == 'UL') {			
		    oListChildren = oChild.childNodes
		    for(j=0;j<oListChildren.length;j++){
				setupShipLocList(oListChildren.item(j), bParCheck)
			}
		}
	}
	
}

//validate forms, checking that all required fields/options have been specified
function validate(oForm)
{
	emailAdd=oForm.sEmail.value.indexOf("@");
//	txt=oForm.txt.value;
	submitOK="True";
	
	if (oForm.sCompany.value=="")
	{
		alert("Please enter your Company");
		submitOK="False";
	}

	if (emailAdd==-1) 
	{
		alert("Please enter a valid e-mail address");
		submitOK="False";
	}

	if (submitOK=="False")
	{
		return false;
	}
}

function formReset(oForm)
{
	oForm.reset()
}

function form_check_old(oForm) {
	return true;
}

var disableButtonMessage = "Please Wait..."

function disableButton(oBtn,disableMessage) {
	
	var oElem,i;
	var oForm = oBtn.form
	if (disableMessage)
	{
    disableButtonMessage = disableMessage
    }
  
	// Create a hidden input field spoofing the information of the submit button
	var oNewElem = document.createElement('input')
	oNewElem.type = 'hidden'
	oNewElem.id = 'ewSubmitClone_' + oBtn.id
	oNewElem.name = 'ewSubmitClone_' + oBtn.name
	oNewElem.value = oBtn.value
	oForm.appendChild(oNewElem)

}

function form_disable_button(oForm,btnID,btnName) {
	for (i=0; i<oForm.length;i++ ) {
		oElem = oForm.elements[i];
		if (oElem.id==btnID && oElem.name==btnName){
			oElem.id+='_old'
			oElem.name+='_old'
			oElem.value = disableButtonMessage
		}	
	}
}

function form_check(oForm) {
	var oElem, i,bValid,cCheckRadio,cTestName,oOptions,bSelected, nElemTypeGroup, cId, cName;
	var aRadioCheck = new Array();
	var bHasDisabledButton = false
	bValid = true;
	
	
	for (i=0; i<oForm.length;i++ ) {
		oElem = oForm.elements[i]
		
		switch (oElem.type) {
			case "text": nElemTypeGroup = 1; break;
			case "textarea": nElemTypeGroup = 1; break;
			case "checkbox": nElemTypeGroup = 3; break;
			case "radio": nElemTypeGroup = 3; break;
			case "select-one": nElemTypeGroup = 2; break;
			case "select-multiple": nElemTypeGroup =2; break;
			default: nElemTypeGroup = 0; break;
		}
		
		// Check if the element is required
		if (oElem.className.toLowerCase().indexOf("required")>=0) {
			switch (nElemTypeGroup) {

				case 1:
				    if (form_check_value(oElem.value)) {
						form_alert("required",oElem)
						bValid = false
					}
					break;
				case 2: 
					if (oElem.selectedIndex < 0) {
						form_alert("required",oElem)
						bValid = false						
					}
					else if (form_check_value(oElem.options[oElem.selectedIndex].text)) {
						form_alert("required",oElem)
						bValid = false					
					}
					break;					
				case 3:
					// Check if the checkbox group has already been checked through
					cCheckRadio = "," + aRadioCheck.join(",") + ","
					cTestName = "," + oElem.name + ","
					if (cCheckRadio.indexOf(cTestName)<0) {
						
						// Not found - let's do the checks
						aRadioCheck.push(oElem.name)
						oOptions = document.getElementsByName(oElem.name)
						bSelected = false;
						if (oOptions.length>1) {
							for (i=0; i<oOptions.length;i++) { if(oOptions[i].checked) { bSelected = true; break } }
						}
						if (!bSelected && oOptions.length>1) {
							form_alert("required",oElem)
							bValid = false	
						}
					}
					break;		
			}
			if (!bValid) { break }
		}
	}
	
	if (bValid) {
		for (i=0; i<oForm.length;i++ ) {
			oElem = oForm.elements[i]		
			if (oElem.type == 'text' ||  oElem.type == 'textarea') {
				if (form_check_value(oElem.value)) {oElem.value = '';}
			}
		}
	}
	
	if (bValid) {
		// Check for Disabled Buttons
		for (i=0; i<oForm.length;i++ ) {
			oElem = oForm.elements[i];
			if (oElem.type=="hidden" && oElem.id.indexOf("ewSubmitClone_")==0) {
				cId = oElem.id.replace(/ewSubmitClone_/,"")
				cName = oElem.name.replace(/ewSubmitClone_/,"")
				form_disable_button(oForm,cId,cName)
				oElem.id=cId
				oElem.name=cName
				bHasDisabledButton = true;
			}
		}
		
		if (bHasDisabledButton) {
			for (i=0; i<oForm.length;i++ ) {
				oElem = oForm.elements[i];
				if (oElem.type=="submit" || oElem.type=="button") {oElem.disabled=true;}
			}
		}	
	}
	
	return bValid;
}

function form_alert(cAlertType,oElem) {

	var cLabel
	// Get the label	
	cLabel = form_get_label(oElem)
	switch (cAlertType) {
	
		case "required":
			if (cLabel=="") {
				alert("You must complete all the required information")
			}
			else {
				alert("You have not any information in the field : " + cLabel)
			}
			oElem.focus()
			break;
	}
}


function form_get_label(oElem) {

	var cLabel, oLabels, i

	cLabel=""
	oLabels = document.getElementsByTagName("label")

	for (i=0; i<oLabels.length;i++ ) {
		if (oLabels[i].htmlFor == oElem.name) { cLabel = oLabels[i].firstChild.nodeValue; break; }
	}
	
	return cLabel;


}

function form_check_value(cValue) {

	var aKeyDefs = new Array("please enter","[please enter","[select ","please select","[please select","por favor preencha o","Svp complet")
	var bIsDefault,i
	
	bIsDefault = false
	cValue = cValue.toString()
	cValue = cValue.toLowerCase();
	for (i=0; i<aKeyDefs.length;i++ ) {
		if (cValue.substr(0,aKeyDefs[i].length).toLowerCase() == aKeyDefs[i].toLowerCase() || cValue=="") { bIsDefault = true }
	}
	
	return bIsDefault
}

function form_batch_checkbox(oForm, bChecked) {
	var oElem, i
	a = 0
	for (i=0; i<oForm.length;i++ ) {
		oElem = oForm.elements[i];
		if (oElem.type=="checkbox") {oElem.checked = bChecked;}
	} 
}

function pollCheck(o) { 
	var pVal;
	pVal = false;
	for(i=0;i<o.length; i++) {
		if (o.elements[i].type=='radio' && o.elements[i].checked) { pVal = true; }
	}
	if (!pVal) {alert('You have not selected anything to vote for!');}
	return pVal;
}

// AliG functions - recursive position finders.
  function getLeft(obj) {
    var nLeft=obj.offsetLeft;
    while((obj=obj.offsetParent)!=null) { nLeft+=obj.offsetLeft; }
    return nLeft;
  }

  function getTop(obj) {
    var nTop=obj.offsetTop;
    while((obj=obj.offsetParent)!=null) { nTop+=obj.offsetTop; }
    return nTop;
  }  

  function getRight(obj) {
    var nRight=obj.offsetRight;
    while((obj=obj.offsetParent)!=null) { nRight+=obj.offsetRight; }
    return nRight;
  }

  function getBottom(obj) {
    var nBottom=obj.offsetBottom;
    while((obj=obj.offsetParent)!=null) { nBottom+=obj.offsetBottom; }
    return nBottom;
  } 

  function getWidth(obj) {
    var nWidth=obj.offsetWidth;
    return nWidth;
  } 

  function getScrollTop() {
	return document.documentElement['scrollTop'] ? document.documentElement['scrollTop'] : document.body['scrollTop'];
  }

  function getScrollLeft() {
	return document.documentElement['scrollLeft'] ? document.documentElement['scrollLeft'] : document.body['scrollLeft'];
  }
  function getVisHeight() {
    return document.documentElement['clientHeight'] ? document.documentElement['clientHeight'] : document.body['clientHeight']
  }
  function getVisWidth() {
    return document.documentElement['clientWidth'] ? document.documentElement['clientWidth'] : document.body['clientWidth']
  }
//
//
//
//


// Expand and Detract Menu Admin-Page Layouts

function hideAndShow(hiddenElement, operation){
	if (operation=1){
		document.getElementById(hiddenElement).style.display = "block";
	}
	if (operation=0){
		document.getElementById(hiddenElement).style.display = "none";
	}
}

function Hashtable(){
    this.clear = hashtable_clear;
    this.containsKey = hashtable_containsKey;
    this.containsValue = hashtable_containsValue;
    this.get = hashtable_get;
    this.isEmpty = hashtable_isEmpty;
    this.keys = hashtable_keys;
    this.put = hashtable_put;
    this.remove = hashtable_remove;
    this.size = hashtable_size;
    this.toString = hashtable_toString;
    this.values = hashtable_values;
    this.hashtable = new Array();
}

/*=======Private methods for internal use only========*/

function hashtable_clear(){
    this.hashtable = new Array();
}

function hashtable_containsKey(key){
    var exists = false;
    for (var i in this.hashtable) {
        if (i == key && this.hashtable[i] != null) {
            exists = true;
            break;
        }
    }
    return exists;
}

function hashtable_containsValue(value){
    var contains = false;
    if (value != null) {
        for (var i in this.hashtable) {
            if (this.hashtable[i] == value) {
                contains = true;
                break;
            }
        }
    }
    return contains;
}

function hashtable_get(key){
    return this.hashtable[key];
}

function hashtable_isEmpty(){
    return (parseInt(this.size()) == 0) ? true : false;
}

function hashtable_keys(){
    var keys = new Array();
    for (var i in this.hashtable) {
        if (this.hashtable[i] != null) 
            keys.push(i);
    }
    return keys;
}

function hashtable_put(key, value){
    if (key == null || value == null) {
        throw "NullPointerException {" + key + "},{" + value + "}";
    }else{
        this.hashtable[key] = value;
    }
}

function hashtable_remove(key){
    var rtn = this.hashtable[key];
    this.hashtable[key] = null;
    return rtn;
}

function hashtable_size(){
    var size = 0;
    for (var i in this.hashtable) {
        if (this.hashtable[i] != null) 
            size ++;
    }
    return size;
}

function hashtable_toString(){
    var result = "";
    for (var i in this.hashtable)
    {      
        if (this.hashtable[i] != null) 
            result += "{" + i + "},{" + this.hashtable[i] + "}\n";   
    }
    return result;
}

function hashtable_values(){
    var values = new Array();
    for (var i in this.hashtable) {
        if (this.hashtable[i] != null) 
            values.push(this.hashtable[i]);
    }
    return values;
}

var _priceHash = new Hashtable();

function updatePrice(priceId,optionId,value)
{
    //alert(priceId + ' - ' + value);
    nPrice = (document.getElementById(priceId).innerHTML * 1 )
    //add to array
    
    if (_priceHash.containsKey(optionId) == true){
    //deduct the old price
    nPrice = nPrice - _priceHash.get(optionId);
    _priceHash.put(optionId,value);
    }
    else {
    _priceHash.put(optionId,value)
    }
   
    document.getElementById(priceId).innerHTML = formatAsMoney(nPrice + (value * 1 ))
}
 //  Adds up all the selected items in the options forms and changes the price to include the option cost
 
function updatePriceCbox(priceId,optionId,value,checkboxElmt)
{
    
    if (checkboxElmt.checked){
    updatePrice(priceId,optionId,value)
    }
    else{
    nPrice = (document.getElementById(priceId).innerHTML * 1 )
    nPrice = nPrice - value;
    _priceHash.remove(optionId)
    document.getElementById(priceId).innerHTML = formatAsMoney(nPrice)
    }   
}

function formatAsMoney(mnt) {
    mnt -= 0;
    mnt = (Math.round(mnt*100))/100;
    return (mnt == Math.floor(mnt)) ? mnt + '.00' 
              : ( (mnt*10 == Math.floor(mnt*10)) ? 
                       mnt + '0' : mnt);
}


// Takes an array and a SELECT element and calls the updateprice function
function updateSelectPrice(obj,priceId,optionId,priceArray) {

    // Get the selected element
    var index = obj.selectedIndex
    updatePrice(priceId,optionId,priceArray[index]);
}

//  Increments the quantity
//  Does not allow a negative quantity !!

function incrementQuantity(inputName,operator)
{
    if (operator == '+')
    {
        document.getElementById(inputName).value = (document.getElementById(inputName).value*1) + 1;
    }
    else
    {
        if (document.getElementById(inputName).value > 0)
        {
            document.getElementById(inputName).value = (document.getElementById(inputName).value*1) - 1;
        }
        
    }
    
    
}

    function PadDigits(n, totalDigits) 
    { 
        n = n.toString(); 
        var pd = ''; 
        if (totalDigits > n.length) 
        { 
            for (i=0; i < (totalDigits-n.length); i++) 
            { 
                pd += '0'; 
            } 
        } 
        return pd + n.toString(); 
    } 


function checkAll(field) 
{ 
   
        for (i = 0; i < field.length; i++) 
            { 
            field[i].checked = true;
            } 
    
} 
function uncheckAll(field) 
{ 
 
   
  
       for (i = 0; i < field.length; i++) 
            { 
            field[i].checked = false;
            }

        }

        /**
        *JQuery TinyMCE
        */

(function(b) { var c, a = []; function e(g, f, i) { var h; h = b.fn[f]; b.fn[f] = function() { var j; if (g !== "after") { j = i.apply(this, arguments); if (j !== undefined) { return j } } j = h.apply(this, arguments); if (g !== "before") { i.apply(this, arguments) } return j } } b.fn.tinymce = function(i) { var h = this, g, j = "", f; if (!h.length) { return } if (!i) { return tinyMCE.get(this[0].id) } function k() { if (d) { d(); d = null } h.each(function(m, p) { var l, o = p.id || tinymce.DOM.uniqueId(); p.id = o; l = new tinymce.Editor(o, i); l.render() }) } if (!window.tinymce && !c && (g = i.script_url)) { c = 1; if (/_(src|dev)\.js/g.test(g)) { j = "_src" } window.tinyMCEPreInit = { base: g.substring(0, g.lastIndexOf("/")), suffix: j, query: "" }; b.getScript(g, function() { tinymce.dom.Event.domLoaded = 1; c = 2; k(); b.each(a, function(l, m) { m() }) }) } else { if (c === 1) { a.push(k) } else { k() } } }; b.extend(b.expr[":"], { tinymce: function(f) { return f.id && !!tinyMCE.get(f.id) } }); function d() { function f() { this.find("span.mceEditor,div.mceEditor").each(function(j, k) { var h; if (h = tinyMCE.get(k.id.replace(/_parent$/, ""))) { h.remove() } }) } function g(i) { var h; if (i !== undefined) { f.call(this); this.each(function(k, l) { var j; if (j = tinyMCE.get(l.id)) { j.setContent(i) } }) } else { if (this.length > 0) { if (h = tinyMCE.get(this[0].id)) { return h.getContent() } } } } e("both", "text", function(h) { if (h !== undefined) { return g.call(this, h) } if (this.length > 0) { if (ed = tinyMCE.get(this[0].id)) { return ed.getContent().replace(/<[^>]+>/g, "") } } }); b.each(["val", "html"], function(j, h) { e("both", h, g) }); b.each(["append", "prepend"], function(j, h) { e("before", h, function(i) { if (i !== undefined) { this.each(function(l, m) { var k; if (k = tinyMCE.get(m.id)) { if (h === "append") { k.setContent(k.getContent() + i) } else { k.setContent(i + k.getContent()) } } }) } }) }); e("both", "attr", function(h, i) { if (h && h === "value") { return g.call(this, i) } }); b.each(["remove", "replaceWith", "replaceAll", "empty"], function(j, h) { e("before", h, f) }) } })(jQuery);

/**
* GcColor colorpicker plug-in for jQuery
* Originaly written by Stefan Petre <www.eyecon.ro>
* @author Gusts 'gusC' Kaksis <gusts.kaksis@gmail.com>
* @version 1.0.3
*/
(function($) {
    var gcColor = function() {
        var defaults = {
            onOpen: function() { },
            onClose: function() { },
            onChange: function() { },
            useButton: true,
            defaultColor: '#FF0000'
        },
		_uiInstalled = (typeof $.ui == 'undefined' ? false : true),
		_dialogBody = '<div id="gccolor-dialog" style="display: none;">'
  		+ '<div id="gccolor-color">'
  		+ '<div>'
  		+ '<div></div>'
  		+ '</div>'
  		+ '</div>'
			+ '<div id="gccolor-hue">'
			+ '<div></div>'
			+ '</div>'
			+ '<div id="gccolor-new-color"></div>'
			+ '<div id="gccolor-current-color"></div>'
			+ '<div id="gccolor-hex"><input type="text" maxlength="6" size="6" /></div>'
			+ '<div id="gccolor-rgb-r" class="gccolor-field"><input type="text" maxlength="3" size="3" /><span></span></div>'
			+ '<div id="gccolor-rgb-g" class="gccolor-field"><input type="text" maxlength="3" size="3" /><span></span></div>'
			+ '<div id="gccolor-rgb-b" class="gccolor-field"><input type="text" maxlength="3" size="3" /><span></span></div>'
			+ '<div id="gccolor-hsb-h" class="gccolor-field"><input type="text" maxlength="3" size="3" /><span></span></div>'
			+ '<div id="gccolor-hsb-s" class="gccolor-field"><input type="text" maxlength="3" size="3" /><span></span></div>'
			+ '<div id="gccolor-hsb-b" class="gccolor-field"><input type="text" maxlength="3" size="3" /><span></span></div>'
			+ '<div id="gccolor-submit"></div>'
			+ '</div>',
		_startHue = function(e) {
		    $(document).data('gccolor').dragItem = {
		        lastX: e.pageX,
		        lastY: e.pageY
		    };
		    _dragHue(e);
		    $(document).bind('mousemove', _dragHue);
		    $(document).bind('mouseup', _endHue);
		},
		_dragHue = function(e) {
		    var item = $('#gccolor-hue');
		    var y = e.pageY - item.offset().top;
		    if (y < 0) {
		        y = 0;
		    } else if (y > 150) {
		        y = 150;
		    }
		    $(document).data('gccolor').hsb.h = 359 - Math.round((y / 150) * 359);
		    if (!$.browser.msie) {
		        _setFromHSB($(document).data('gccolor').hsb);
		    } else {
		        $('#gccolor-hue div').css('top', y + 'px');
		    }
		    changeColor();
		    return false;
		},
		_endHue = function(e) {
		    $(document).unbind('mousemove', _dragHue);
		    $(document).unbind('mouseup', _endHue);
		    $(document).data('gccolor').dragItem = null;
		    if ($.browser.msie) {
		        _setFromHSB($(document).data('gccolor').hsb);
		    }
		},
		_startColor = function(e) {
		    $(document).data('gccolor').dragItem = {
		        lastX: e.pageX,
		        lastY: e.pageY
		    };
		    _dragColor(e);
		    $(document).bind('mousemove', _dragColor);
		    $(document).bind('mouseup', _endColor);
		},
		_dragColor = function(e) {
		    var item = $('#gccolor-color > div');
		    var x = e.pageX - item.offset().left;
		    var y = e.pageY - item.offset().top;
		    if (x < 0) {
		        x = 0;
		    } else if (x > 150) {
		        x = 150;
		    }
		    if (y < 0) {
		        y = 0;
		    } else if (y > 150) {
		        y = 150;
		    }
		    $(document).data('gccolor').hsb.s = Math.round((x / 150) * 100);
		    $(document).data('gccolor').hsb.b = 100 - Math.round((y / 150) * 100);
		    if (!$.browser.msie) {
		        _setFromHSB($(document).data('gccolor').hsb);
		    } else {
		        $('#gccolor-color > div div').css('top', y + 'px');
		        $('#gccolor-color > div div').css('left', x + 'px');
		    }
		    changeColor();
		    return false;
		},
		_endColor = function(e) {
		    $(document).unbind('mousemove', _dragColor);
		    $(document).unbind('mouseup', _endColor);
		    $(document).data('gccolor').dragItem = null;
		    if ($.browser.msie) {
		        _setFromHSB($(document).data('gccolor').hsb);
		    }
		},
		_startUnit = function(e) {
		    $(document).data('gccolor').dragItem = {
		        item: $(this),
		        lastX: e.pageX,
		        lastY: e.pageY
		    };
		    $(document).bind('mousemove', _dragUnit);
		    $(document).bind('mouseup', _endUnit);
		},
		_dragUnit = function(e) {
		    var item = $(document).data('gccolor').dragItem.item;
		    var name = item.parent().attr('id')
		    var deltaY = e.pageY - $(document).data('gccolor').dragItem.lastY;
		    var prevVal = parseInt(item.prev().val());
		    var newVal = prevVal;
		    if (deltaY < 0) {
		        newVal = prevVal + 1;
		    } else if (deltaY > 0) {
		        newVal = prevVal - 1;
		    }
		    if (name == 'gccolor-hsb-h') {
		        if (newVal > 359) {
		            newVal = 0;
		        } else if (newVal <= 0) {
		            newVal = 359;
		        }
		    } else if (name == 'gccolor-hsb-s' || name == 'gccolor-hsb-b') {
		        if (newVal > 100) {
		            newVal = 100;
		        } else if (newVal <= 0) {
		            newVal = 0;
		        }
		    } else {
		        if (newVal > 255) {
		            newVal = 255;
		        } else if (newVal <= 0) {
		            newVal = 0;
		        }
		    }
		    var rgb = _HSBtoRGB($(document).data('gccolor').hsb);
		    switch (name) {
		        case 'gccolor-hsb-h':
		            $(document).data('gccolor').hsb.h = newVal;
		            break;
		        case 'gccolor-hsb-s':
		            $(document).data('gccolor').hsb.s = newVal;
		            break;
		        case 'gccolor-hsb-b':
		            $(document).data('gccolor').hsb.b = newVal;
		            break;
		        case 'gccolor-rgb-r':
		            rgb.r = newVal;
		            $(document).data('gccolor').hsb = _RGBtoHSB(rgb);
		            break;
		        case 'gccolor-rgb-g':
		            rgb.g = newVal;
		            $(document).data('gccolor').hsb = _RGBtoHSB(rgb);
		            break;
		        case 'gccolor-rgb-b':
		            rgb.b = newVal;
		            $(document).data('gccolor').hsb = _RGBtoHSB(rgb);
		            break;
		    }
		    if (!$.browser.msie) {
		        _setFromHSB($(document).data('gccolor').hsb);
		    }
		    changeColor();
		    item.prev().val(newVal);
		    $(document).data('gccolor').dragItem.lastY = e.pageY;
		},
		_endUnit = function(e) {
		    $(document).unbind('mousemove', _dragUnit);
		    $(document).unbind('mouseup', _endUnit);
		    $(document).data('gccolor').dragItem = null;
		    if ($.browser.msie) {
		        _setFromHSB($(document).data('gccolor').hsb);
		    }
		},
		_HEXtoRGB = function(hex) {
		    var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
		    return { r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF) };
		},
		_HSBtoRGB = function(hsb) {
		    var b = Math.ceil(hsb.b * 2.55)
		    if (hsb.b == 0) {
		        return { r: 0, g: 0, b: 0 };
		    } else if (hsb.s == 0) {
		        return { r: b, g: b, b: b };
		    }
		    var Hi = Math.floor(hsb.h / 60);
		    var f = hsb.h / 60 - Hi;
		    var p = Math.round(hsb.b * (100 - hsb.s) * 0.0255);
		    var q = Math.round(hsb.b * (100 - f * hsb.s) * 0.0255);
		    var t = Math.round(hsb.b * (100 - (1 - f) * hsb.s) * 0.0255);
		    switch (Hi) {
		        case 0: return { r: b, g: t, b: p }; break;
		        case 1: return { r: q, g: b, b: p }; break;
		        case 2: return { r: p, g: b, b: t }; break;
		        case 3: return { r: p, g: q, b: b }; break;
		        case 4: return { r: t, g: p, b: b }; break;
		        case 5: return { r: b, g: p, b: q }; break;
		    }
		    return { r: 0, g: 0, b: 0 };
		},
		_RGBtoHSB = function(rgb) {
		    var hsb = {};
		    hsb.b = Math.max(Math.max(rgb.r, rgb.g), rgb.b);
		    hsb.s = (hsb.b <= 0) ? 0 : Math.round(100 * (hsb.b - Math.min(Math.min(rgb.r, rgb.g), rgb.b)) / hsb.b);
		    hsb.b = Math.round((hsb.b / 255) * 100);
		    if ((rgb.r == rgb.g) && (rgb.g == rgb.b)) hsb.h = 0;
		    else if (rgb.r >= rgb.g && rgb.g >= rgb.b) hsb.h = 60 * (rgb.g - rgb.b) / (rgb.r - rgb.b);
		    else if (rgb.g >= rgb.r && rgb.r >= rgb.b) hsb.h = 60 + 60 * (rgb.g - rgb.r) / (rgb.g - rgb.b);
		    else if (rgb.g >= rgb.b && rgb.b >= rgb.r) hsb.h = 120 + 60 * (rgb.b - rgb.r) / (rgb.g - rgb.r);
		    else if (rgb.b >= rgb.g && rgb.g >= rgb.r) hsb.h = 180 + 60 * (rgb.b - rgb.g) / (rgb.b - rgb.r);
		    else if (rgb.b >= rgb.r && rgb.r >= rgb.g) hsb.h = 240 + 60 * (rgb.r - rgb.g) / (rgb.b - rgb.g);
		    else if (rgb.r >= rgb.b && rgb.b >= rgb.g) hsb.h = 300 + 60 * (rgb.r - rgb.b) / (rgb.r - rgb.g);
		    else hsb.h = 0;
		    hsb.h = Math.round(hsb.h);
		    return hsb;
		},
		_RGBtoHEX = function(rgb) {
		    var hex = [
				rgb.r.toString(16),
				rgb.g.toString(16),
				rgb.b.toString(16)
			];
		    $.each(hex, function(nr, val) {
		        if (val.length == 1) {
		            hex[nr] = '0' + val;
		        }
		    });
		    return hex.join('');
		},
		_setFields = function(hsb, rgb, hex) {
		    $('#gccolor-hsb-h input').val(hsb.h);
		    $('#gccolor-hsb-s input').val(hsb.s);
		    $('#gccolor-hsb-b input').val(hsb.b);
		    $('#gccolor-rgb-r input').val(rgb.r);
		    $('#gccolor-rgb-g input').val(rgb.g);
		    $('#gccolor-rgb-b input').val(rgb.b);
		    $('#gccolor-hex input').val(hex);
		    $('#gccolor-new-color').css('background-color', '#' + hex);
		    var colorBGhex = _RGBtoHEX(_HSBtoRGB({ h: hsb.h, s: 100, b: 100 }));
		    $('#gccolor-color').css('background-color', '#' + colorBGhex);
		    $('#gccolor-color > div div').css('top', (((100 - hsb.b) / 100) * 150) + 'px');
		    $('#gccolor-color > div div').css('left', ((hsb.s / 100) * 150) + 'px');
		    $('#gccolor-hue div').css('top', (150 - ((hsb.h / 359) * 150)) + 'px');
		},
		_setFromHSB = function(hsb) {
		    $(document).data('gccolor').hsb = hsb;
		    var rgb = _HSBtoRGB(hsb);
		    var hex = _RGBtoHEX(rgb);
		    _setFields(hsb, rgb, hex);
		},
		_setFromRGB = function(rgb) {
		    var hex = _RGBtoHEX(rgb);
		    var hsb = _RGBtoHSB(rgb);
		    $(document).data('gccolor').hsb = hsb;
		    _setFields(hsb, rgb, hex);
		},
		_setFromHEX = function(hex) {
		    var rgb = _HEXtoRGB(hex);
		    var hsb = _RGBtoHSB(rgb);
		    $(document).data('gccolor').hsb = hsb;
		    _setFields(hsb, rgb, hex);
		},
		closeOnEsc = function(e) {
		    if (e.keyCode == 27) {
		        $('#gccolor-dialog').hide();
		        var data = $(document).data('gccolor');
		        closeDialog(data.target, data.options, true);
		    }
		},
		openDialog = function(target, options) {
		    $(document).data('gccolor', {
		        target: target,
		        options: options,
		        hsb: { h: 0, s: 100, b: 100 },
		        dragItem: null
		    });
		    if (typeof options.onOpen == 'function') {
		        options.onOpen(target);
		    }
		    var hexColor = $(target).val().replace('#', '').toUpperCase();
		    if (hexColor.length <= 0) {
		        hexColor = options.defaultColor;
		    }
		    _setFromHEX(hexColor);
		    $('#gccolor-current-color').css('background-color', '#' + hexColor);

		    $('#gccolor-submit').click(function() {
		        closeDialog($(document).data('gccolor').target, options, false);
		    });

		    $('#gccolor-dialog').css('top', $(target).offset().top + $(target).outerHeight());
		    $('#gccolor-dialog').css('left', $(target).offset().left);
		    $('#gccolor-dialog').show('slide', { direction: 'up' }, 1000);
		    $(document).keyup(closeOnEsc);
		},
		changeColor = function() {
		    if (typeof $(document).data('gccolor').options.onChange == 'function') {
		        $(document).data('gccolor').options.onChange($(document).data('gccolor').target, _RGBtoHEX(_HSBtoRGB($(document).data('gccolor').hsb)));
		    }
		},
		closeDialog = function(target, options, cancel) {
		    $(document).unbind('keyup', closeOnEsc);
		    if (typeof options.onClose == 'function') {
		        options.onClose(target, $('#gccolor-hex input').val(), cancel);
		    }
		    if (!cancel) {
		        $(target).val('#' + $('#gccolor-hex input').val());
		    }
		    $('#gccolor-dialog').hide();
		    $('#gccolor-dialog').dialog('destroy');
		};

        return {
            init: function(options) {
                options = $.extend({}, defaults, options || {});
                if (_uiInstalled) {
                    if (!$('#gccolor-dialog').is('div')) {
                        // We need only one instance
                        $('body').append(_dialogBody);
                    }
                } else {
                    alert('Sorry, jQuery UI plug-in is required for GcColor to work!');
                }

                $('#gccolor-dialog span').bind('mousedown', _startUnit);
                $('#gccolor-hue').bind('mousedown', _startHue);
                $('#gccolor-color > div').bind('mousedown', _startColor);

                return this.each(function() {
                    if (options.useButton) {
                        $(this).wrap('<span class="gccolor-wrapper"></span>')
                        $(this).after('<a href="Javascript:;" class="gccolor-button">Pick a color!</a>');
                        var button = $(this).next();
                        $(this).width($(this).width() - 22);
                        $(this).css('margin-right', '24px');
                        button.css('left', ($(this).position().left + $(this).outerWidth(true) - 22) + 'px');
                        button.click(function() {
                            openDialog($(this).prev(), options);
                        });
                    } else {
                        $(this).click(function() {
                            openDialog($(this), options);
                        });
                    }
                });
            }
        };
    } ();
    $.fn.extend({
        gccolor: gcColor.init
    });
})(jQuery);

/**
 * SWFObject v1.4.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){if(!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){_16.push(key+"="+_18[key]);}
return _16;},getSWFHTML:function(){var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";
}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();return true;
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}
catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return _23;};
deconcept.PlayerVersion=function(_27){
this.major=_27[0]!=null?parseInt(_27[0]):0;
this.minor=_27[1]!=null?parseInt(_27[1]):0;
this.rev=_27[2]!=null?parseInt(_27[2]):0;
};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){
return false;
}return true;};
deconcept.util={getRequestParameter:function(_29){
var q=document.location.search||document.location.hash;
if(q){var _2b=q.substring(1).split("&");
for(var i=0;i<_2b.length;i++){
if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){if(window.opera||!document.all){return;}
var _2d=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2d.length;i++){_2d[i].style.display="none";for(var x in _2d[i]){
if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}}}};
deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};
__flash_savedUnloadHandler=function(){};
if(typeof window.onunload=="function"){
var _30=window.onunload;
window.onunload=function(){
deconcept.SWFObjectUtil.cleanupSWFs();_30();};
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}};
if(typeof window.onbeforeunload=="function"){
var oldBeforeUnload=window.onbeforeunload;
window.onbeforeunload=function(){
deconcept.SWFObjectUtil.prepUnload();
oldBeforeUnload();};
}else{window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;}
if(Array.prototype.push==null){
Array.prototype.push=function(_31){
this[this.length]=_31;
return this.length;};}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject;
var SWFObject=deconcept.SWFObject;

