﻿// JScript File

void function setFocusOnSaveButton(buttonName)
{
	var currentValue;
	currentValue = window.event.keyCode
		
	if (currentValue==13)
	{
		var btn = document.getElementById(buttonName);
		if(btn != null){
			btn.focus();
			btn.click();
		}
	}
	else
	{
		validKeyPress(currentValue);
	}
} 


void function setFocusOnSaveButtonQuote(buttonName)
{
	var currentValue;
	currentValue = window.event.keyCode
		
	if (currentValue==13)
	{		
		var btn = document.getElementById(buttonName);
		if(btn != null){
			btn.focus();
			btn.click();
		}
	}
	else
	{
		validKeyPressQuote(currentValue);
	}
} 

var sPreviousCurrValue;
function checkCurrency(objElement){
	var blnHasPeriod = false;
	if(objElement.value){
		// Store the org value
		sPreviousCurrValue = objElement.value;
		if(objElement.value.search("[.]") != -1){
			blnHasPeriod = true;	
		}
	}
	// only allow 0-9 and one period
	if(event.keyCode > 57 || event.keyCode < 46 || event.keyCode == 47 || (event.keyCode == 46 && blnHasPeriod == true)){
		return false;
	}
}	

void function validKeyPress(keyCodeEntered) 
{
	//does not allow single quotes
	if (keyCodeEntered == 39) {
		var keyText;
		keyText = '"' + String.fromCharCode(keyCodeEntered) + '" is an illegal character! ';
	
		//alert(keyText); 
		window.event.returnValue = false;
	}
	else {
		changeme();
	}
}

void function validKeyPressQuote(keyCodeEntered) 
{
	changeme();
}

void function numericEntry(isPaste) {
	if (!isPaste) {
        numericKeyPress(window.event.keyCode);
	} else {
	    numericPaste();
	}
}

void function numericKeyPress(keyCodeEntered) 
{
	//only accept numbers
	if (keyCodeEntered < 48 || keyCodeEntered > 57 ) 
	{
		window.event.returnValue = false;
	}
	else {
		changeme();
	}
}

void function limitEntry(limit, isPaste)
{
	var currentText	= window.event.srcElement.value;
	
	//disallow typing if limit has been reached
	if (currentText.length >= limit)
	{
		window.event.returnValue = false;
		alert("This field has reached it\'s " + limit.toString() + " character limit");
	}
	else {
		validKeyPress(window.event.keyCode);
	}
	
	//handle pasting as well
	if (isPaste)
	{
		var txt = window.clipboardData.getData("Text");
		if ((currentText.length + txt.length) > limit)
		{
			window.event.returnValue = false;
			alert("Cannot paste this data, as the " + limit.toString() + " character limit for this field would be exceeded");
		}
		//...including whether paste contains anything invalid
		validatePaste(true);
	}
}
			
void function validatePaste(allowQuote)
{
	//checks for invalid chars in paste string
	var txt = new String(window.clipboardData.getData("Text"));
	//var index = 0 ;
	//var code ;
	
	if ((allowQuote == 0) && (txt.indexOf("'") != -1)) 
	{		
		alert("Cannot paste: content contains an invalid character");		
		window.event.returnValue = false;
	}
	else
	{
		changeme();
	}
}

void function numericPaste()
{
	//checks for invalid chars in paste string
	var txt = new String(window.clipboardData.getData("Text"));
	var index = 0 ;
	var code ;
	
	while (index < txt.length)
	{
		code = txt.charCodeAt(index); 
		
		if (code < 48 || code > 57 ) 
		{
			window.event.returnValue = false;
			alert("Cannot paste: content contains a non-numeric character");
			break;
		}
		index++
	}
	
	if (window.event.returnValue != false)	changeme();
}

void function decimalPaste(nDecPos)
{
	//checks for invalid chars in paste string
	var txt = new String(window.clipboardData.getData("Text"));
	var index = 0 ;
	var code ;
	
	while (index < txt.length)
	{
		code = txt.charCodeAt(index); 
		
		if (code < 48 || code > 57 ) 
		{
			window.event.returnValue = false;
			alert("Cannot paste: content contains a non-numeric character");
			break;
		}
		index++
	}
	
    nDecLoc = txt.search("[.]")
    if(nDecLoc != -1)
    {
	    // Cannot exceed relevant decimal posns
        if (txt.length-nDecLoc>nDecPos)
        {
            window.event.returnValue=false;
			alert("Cannot paste: content contains too many decimal positions");
        }
    }

	if (window.event.returnValue != false)	changeme();
}

function changeme()
{	
	if (document.form1 && document.form1.isDirty) {
		document.form1.isDirty.value = true;
	}
}

var selectedRow;

void function highlightRow (rowToSelect, hidInput, selectedValue)
{	
	if (typeof(selectedRow) != 'undefined')
	{
		selectedRow.style.backgroundColor = '#EEEEEE';		
	}
		
	// highlight the row
	selectedRow = rowToSelect;
	selectedRow.style.backgroundColor = '#D7D1D1';		


	// set the selected value
	hidInput.value = selectedValue;
}

void function mouseOverRow(rowToSelect)
{
	// highlight the row
	if (rowToSelect.style.backgroundColor != '#d7d1d1')
	{
		rowToSelect.style.backgroundColor = '#E3DDDD';	
	}
}

void function mouseOutRow(rowToSelect)
{
	// highlight the row
	if (rowToSelect.style.backgroundColor != '#d7d1d1')
	{
		rowToSelect.style.backgroundColor = '#EEEEEE';	
	}
}



function validateEmailAddress(sEmailAddress) 
{
	// regular expression to check the format of an email address
    var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
    var regex = new RegExp(emailReg);
    return regex.test(sEmailAddress);	
}


function formatCurrencyValue(Value, Symbol, dp) 
{ 
  var fValue = Value.toFixed(dp); 
  var sValue = fValue + ""; 
  var re = new RegExp("(\\d)(?=(\\d\\d\\d)+(?!\\d))");
  
  return Symbol + (sValue.replace(re, "$1,")); 	  
} 

function showHelp(object)
{
	if (document.layers && document.layers[object] != null)
		document.layers[object].visibility = 'visible';
	else if (document.all)
		document.all[object].style.visibility = 'visible';
}
			
function hideHelp(object)
{
	if (document.layers && document.layers[object] != null)
		document.layers[object].visibility = 'hidden';
	else if (document.all)
		document.all[object].style.visibility = 'hidden';
}

function IEBrowser() 
{
    var nMSIE;
	nOPERA=navigator.userAgent.indexOf("Opera")>=0;
	if (!nOPERA) {
		nMSIE=document.all ? 1 : 0;
	}
	return nMSIE;
}

function trim(s) 
{
  // Remove leading spaces and carriage returns
  
  while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
  {
    s = s.substring(1,s.length);
  }

  // Remove trailing spaces and carriage returns

  while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
  {
    s = s.substring(0,s.length-1);
  }
  return s;
}

/*--------------------------------------------------------------------
|                    modal dialog window for non-IE                  |
|                 From "Simulating Modal Dialog Windows"             |
|                           by Danny Goodman                         |
| for "View Source" developer magazine from Netscape Communications  |
|               <http://developer.netscape.com/viewsource/>          |
--------------------------------------------------------------------*/
/**********************************************************************
  BEGIN MODAL DIALOG CODE (can also be loaded as external .js file)
***********************************************************************/
// Global for brower version branching.
var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4))
// One object tracks the current modal dialog opened from this window.
var dialogWin = new Object()

// Generate a modal dialog.
// Parameters:
//    url -- URL of the page/frameset to be loaded into dialog
//    width -- pixel width of the dialog window
//    height -- pixel height of the dialog window
//    returnFunc -- reference to the function (on this page)
//                  that is to act on the data returned from the dialog
//    args -- [optional] any data you need to pass to the dialog
function openDialog(url, width, height, returnFunc, args) {
//	var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4))
	if (!dialogWin.win || (dialogWin.win && dialogWin.win.closed)) {
		// Initialize properties of the modal dialog object.
		dialogWin.returnFunc = returnFunc
		dialogWin.returnedValue = ""
		dialogWin.args = args
		dialogWin.url = url
		dialogWin.width = width
		dialogWin.height = height
		// Keep name unique so Navigator doesn't overwrite an existing dialog.
		dialogWin.name = (new Date()).getSeconds().toString()
		// Assemble window attributes and try to center the dialog.
		if (Nav4) {
			// Center on the main window.
			dialogWin.left = window.screenX + 
			   ((window.outerWidth - dialogWin.width) / 2)
			dialogWin.top = window.screenY + 
			   ((window.outerHeight - dialogWin.height) / 2)
			var attr = "screenX=" + dialogWin.left + 
			   ",screenY=" + dialogWin.top + ",resizable=no,width=" + 
			   dialogWin.width + ",height=" + dialogWin.height
		} else {
			// The best we can do is center in screen.
			dialogWin.left = (screen.width - dialogWin.width) / 2
			dialogWin.top = (screen.height - dialogWin.height) / 2
			var attr = "left=" + dialogWin.left + ",top=" + 
			   dialogWin.top + ",resizable=no,width=" + dialogWin.width + 
			   ",height=" + dialogWin.height
		}
		
		// Generate the dialog and make sure it has focus.
		dialogWin.win=window.open(dialogWin.url, dialogWin.name, attr)
		dialogWin.win.focus()
	} else {
		dialogWin.win.focus()
	}
}

// Event handler to inhibit Navigator form element 
// and IE link activity when dialog window is active.
function deadend() {
	if (dialogWin.win && !dialogWin.win.closed) {
		dialogWin.win.focus()
		return false
	}
}

// Since links in IE4 cannot be disabled, preserve 
// IE link onclick event handlers while they're "disabled."
// Restore when re-enabling the main window.
var IELinkClicks

// Disable form elements and links in all frames for IE.
function disableForms() {
	IELinkClicks = new Array()
	for (var h = 0; h < frames.length; h++) {
		for (var i = 0; i < frames[h].document.forms.length; i++) {
			for (var j = 0; j < frames[h].document.forms[i].elements.length; j++) {
				frames[h].document.forms[i].elements[j].disabled = true
			}
		}
		IELinkClicks[h] = new Array()
		for (i = 0; i < frames[h].document.links.length; i++) {
			IELinkClicks[h][i] = frames[h].document.links[i].onclick
			frames[h].document.links[i].onclick = deadend
		}
	}
}

// Restore IE form elements and links to normal behavior.
function enableForms() {
	for (var h = 0; h < frames.length; h++) {
		for (var i = 0; i < frames[h].document.forms.length; i++) {
			for (var j = 0; j < frames[h].document.forms[i].elements.length; j++) {
				frames[h].document.forms[i].elements[j].disabled = false
			}
		}
		for (i = 0; i < frames[h].document.links.length; i++) {
			frames[h].document.links[i].onclick = IELinkClicks[h][i]
		}
	}
}

// Grab all Navigator events that might get through to form
// elements while dialog is open. For IE, disable form elements.
function blockEvents() {
//	var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4))
	if (Nav4) {
		window.captureEvents(Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.FOCUS)
		window.onclick = deadend
	} else {
		disableForms()
	}
	window.onfocus = checkModal
}
// As dialog closes, restore the main window's original
// event mechanisms.
function unblockEvents() {
//	var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4))
	if (Nav4) {
		window.releaseEvents(Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.FOCUS)
		window.onclick = null
		window.onfocus = null
	} else {
		enableForms()
	}
}

// Invoked by onFocus event handler of EVERY frame,
// return focus to dialog window if it's open.
function checkModal() {
	if (dialogWin.win && !dialogWin.win.closed) {
		dialogWin.win.focus()	
	}
}

/**************************
  END MODAL DIALOG CODE
**************************/

function getURLParameters() 
{
	var sURL = window.document.URL.toString();
	var sResult = '';
	
	if (sURL.indexOf("?") > 0)
	{			
		var arrParams = sURL.split("?");
			
		var arrURLParams = arrParams[1].split("&");
		
		var arrParamNames = new Array(arrURLParams.length);
		var arrParamValues = new Array(arrURLParams.length);
		
		var i = 0;
		for (i=0;i<arrURLParams.length;i++)
		{
			var sParam =  arrURLParams[i].split("=");
			arrParamNames[i] = sParam[0];
			if (sParam[1] != "")
				arrParamValues[i] = unescape(sParam[1]);
			else
				arrParamValues[i] = "No Value";
		}
		
		for (i=0;i<arrURLParams.length;i++)
		{
			if (sResult == '')
			{
				sResult = '?'
			}
			else
			{
				sResult = sResult + '&';
			}
		
			sResult = sResult + arrParamNames[i]+"="+ arrParamValues[i];
		}
	}

	return sResult;
}

function showEditOptionCellValue(wndw, OrderOptionId, Row, SelectedItemId, PreconfiguredOrder)
{
	wndw.showModalDialog('../fraGenericFrame.aspx?Title=Edit Cell Value&PageAndParams=frmOrdEditOptionCellValue.aspx?OrderOptionId=' + OrderOptionId + '?Row=' + Row + '?SelectedItemId=' + SelectedItemId + '?PreconfiguredOrder=' + PreconfiguredOrder,'', 'scroll: yes;');
}

function pageInWizard(sPage)
{	
	var bResult;
	switch (sPage.toLowerCase())
	{
		case 'frmwizard_template.aspx':
		case 'frmwizard_customer.aspx':
		case 'frmwizard_customeroptions.aspx':
		case 'frmwizard_templateoptions.aspx':
		case 'frmwizard_distribution.aspx':
		case 'frmwizard_submit.aspx':
		case 'frmorderwizard.aspx':
			bResult = true;
			break;
		default:
			bResult = false;
	}        
	
	return bResult;
}

function checkNumeric(objElement, isPaste){
    if (!isPaste) {
	    var blnHasPeriod = false;
	    if(objElement.value){
		    // Store the org value
		    sPreviousValue = objElement.value;
		    if(objElement.value.search("[.]") != -1){
			    blnHasPeriod = true;	
		    }
	    }
	// only allow 0-9 and one period
	    if(event.keyCode > 57 || event.keyCode < 46 || event.keyCode == 47 || (event.keyCode == 46 && blnHasPeriod == true)){
		    return false;
	    }
	} else {
	    numericPaste()
	}
	
	
}

function checkFormattedNumber(objElement, isPaste){
    if (!isPaste) {
        // This function only allows numerics as well as the '-' sign
	    var blnHasPeriod = false;
	    if(objElement.value){
		    // Store the org value
		    sPreviousValue = objElement.value;
		    if(objElement.value.search("[.]") != -1){
			    blnHasPeriod = true;	
		    }
	    }
	    // only allow 0-9 and one period and '-' signs
	    if(event.keyCode > 57 || event.keyCode < 45 || event.keyCode == 47 || (event.keyCode == 46 && blnHasPeriod == true)){
		    return false;
	    }
	} else {
	    numericPaste()
	}
}

function checkDecimal(objElement, nDecPos, isPaste){
    if (!isPaste) {
        // This function only allows numerics as well as the '-' sign
	    var blnHasPeriod = false;
	    if(objElement.value){
		    // Store the org value
		    sPreviousValue = objElement.value;
		    nDecLoc = objElement.value.search("[.]")
	    
		    if(nDecLoc != -1)
		    {
			    blnHasPeriod = true;	
			    // Cannot exceed relevant decimal posns
		        if (objElement.value.length-nDecLoc>nDecPos) return false;
		    }
	    }
	    
	    // only allow 0-9 and one period and '-' signs
	    if(event.keyCode > 57 || event.keyCode < 45 || event.keyCode == 47 || (event.keyCode == 46 && blnHasPeriod == true)){
		    return false;
	    }
	} else {
	    decimalPaste(nDecPos)
	}
}

function checkPhoneNumber(objElement, isPaste){
    var keynum;

    if(window.event) // IE
    {
        keynum = objElement.keyCode;
    }
    else if(objElement.which) // Netscape/Firefox/Opera
    {
        keynum = objElement.which;
    }
    if (!isPaste) {
        // only allow 0-9 and - ( )
        if(keynum == 8){
		    return true;
	    }
	    if(keynum > 57 || keynum < 40 || keynum == 47 || keynum == 46 || keynum == 42 || keynum == 43 || keynum == 44){
		    return false;
	    }
	} else {
	    PhonePaste()
	}
}

void function PhonePaste()
{
	//checks for invalid chars in paste string
	var txt = new String(window.clipboardData.getData("Text"));
	var index = 0 ;
	var code ;
	
	while (index < txt.length)
	{
		code = txt.charCodeAt(index); 
		
		if (code > 57 || code < 40 || code == 47 || code == 46 || code == 42 || code == 43 || code == 44)
		{
			window.event.returnValue = false;
			alert("Cannot paste: content contains an invalid character");
			break;
		}
		index++
	}
	
	if (window.event.returnValue != false)	changeme();
}

function checkNegNumeric(objElement){
	var blnHasPeriod = false;
	var bHasNeg = false
	if(objElement.value){
		// Store the org value
		sPreviousValue = objElement.value;
		if(objElement.value.search("[.]") != -1){
			blnHasPeriod = true;	
		}
		
		if(objElement.value.search("[-]") != -1){
			bHasNeg = true;	
		}
		
	}
	// only allow 0-9 and one period and -
	
	if(event.keyCode > 57  || event.keyCode < 45 || event.keyCode == 47 || (event.keyCode == 45 && bHasNeg == true) || (event.keyCode == 46 && blnHasPeriod == true)){
		return false;
	}
}

function setNumericBounds(objElement, minValue, maxValue){
    if (Number(objElement.value) < Number(minValue))
    {
        objElement.value = minValue
    }
    
    if (Number(objElement.value) > Number(maxValue))
    {
        objElement.value = maxValue
    }
}

function checkInteger(isPaste)
{
    if (!isPaste) {
	    // only allow 0-9
	    if(event.keyCode > 57 || event.keyCode < 47)
	    {
		    return false;
	    }
	} else {
	    intPaste()
	}
}

void function intPaste()
{
	//checks for invalid chars in paste string
	var txt = new String(window.clipboardData.getData("Text"));
	var index = 0 ;
	var code ;
	
	while (index < txt.length)
	{
		code = txt.charCodeAt(index); 
		
		if (code < 47 || code > 57 ) 
		{
			window.event.returnValue = false;
			alert("Cannot paste: content contains a non-numeric character");
			break;
		}
		index++
	}
	
	if (window.event.returnValue != false)	changeme();
}

function deleteSelectedItem(obj)
{
    if (confirm("Are you sure that you wish to delete this item?"))
    {
        return true;
    }
    else
    {
        return false;
    }
}

function deleteItem(sItemName)
{
    if (confirm("Are you sure that you wish to delete this " + sItemName + "?"))
    {
        return true;
    }
    else
    {
        return false;
    }
}

function Cancel(obj)
{
    if (confirm("Are you sure that you wish to Cancel?"))
    {
        return true;
    }
    else
    {
        return false;
    }
}

function deleteArticle(obj)
{
    if (confirm("Are you sure you wish to Delete this article?"))
    {
        return true;
    }
    else
    {
        return false;
    }
}

function DeleteComments(obj)
{
    if (confirm("Are you sure you wish to Delete this comment?"))
    {
        return true;
    }
    else
    {
        return false;
    }
}
function SubmitArticle(obj)
{
    if (confirm("Are you sure you wish to Submit this article?"))
    {
        return true;
    }
    else
    {
        return false;
    }
}

function ApproveArticle(obj)
{
    if (confirm("Are you sure you wish to Approve this article?"))
    {
        return true;
    }
    else
    {
        return false;
    }
}

function RemovePlayer()
{
    if (confirm("Are you sure you wish to remove this player/manager from Six Plus Five?\nUsers will no longer be able to select this person in future articles and will remove their association to any existing articles."))
    {
        return true;
    }
    else
    {
        return false;
    }
}

// This function allows an existing window to be re-used and given focus
function windowOpener(url, name, args) 
{
    if (typeof(showWin) != "object")
    {
        showWin = window.open(url,name,args);
    } 
    else 
    {
        if (!showWin.closed)
        { 
            showWin.location.href = url;
        } 
        else 
        {
            showWin = window.open(url, name,args);
        }
    }
    showWin.focus();
}
function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

function GoToAnchor(ancname)
{
    // safari fix
    window.location.hash = ancname & 'not';
    window.location.hash = ancname;
}


//Image Upload Function
function LoadImage(imgprevref, hdnref, artid, imgtype, spremove) {
    var sRetValue;
    var spRem;
    var hdn;
    var imgprev;
    hdn = document.getElementById(hdnref);
    imgprev = document.getElementById(imgprevref);
    if(spremove!=null) {
        spRem = spremove;
    } else {
        spRem = '';    
    }
    try
    {
        if (!IEBrowser())
        {
            window.open("frmAddImage.aspx?hdnClientID=" + hdn.id + "&hdnImgPrevID=" + imgprev.id + "&ArticleID=" + artid + "&ImgType=" + imgtype + "&spRemove=" + spRem,"Upload Image","height=300,width=500,resizable=no,center=yes,");
        }
        else {
            sRetValue = window.showModalDialog('../fraGenericFrame.aspx?Title=Upload Image&PageAndParams=admin/frmAddImage.aspx?ParentID=-1?hdnClientID=' + hdn.id + "?ImgType=" + imgtype + "?hdnImgPrevID=" + imgprev.id + "?ArticleID=" + artid + '?Context=','','dialogwidth: 500px; dialogheight: 340px; status: 0; scroll: 1; help: 0; center:yes;');
            if (sRetValue != undefined) {
                imgprev.src =  sRetValue;
                hdn.value = sRetValue.substring(sRetValue.lastIndexOf("/")+1);
                imgprev.style.display = "inline";
                if (spRem!='') {
                    document.getElementById(spRem).style.display = "inline";
                }
            }
        }   
    }
    catch(error)
    {
        window.alert('Cannot display the pop-up window. You may need to disable your Pop-Up blocker.');
    }
}

function HideRemoveOption(obj, imgprev, hdn) {
    obj.style.display = "none";
    imgprev.style.display = "none";
    document.getElementById(hdn).value = "";
}


function OpenPopup(frm, params, title, h, w) {
    var frmname;
    frmname = frm;
    try
    {
        if (!IEBrowser())
        {
            window.open(frmname + params,title ,"height=" + h + ",width=" + w + ",resizable=no,center=yes,");
        }
        else {
            if (frmname.substring(0,3) == '../') {
                frmname = frmname.substring(3, frmname.length);
            }
            
            // because of urlrewrite we require complete urls for any path.
            var frmGeneric = frmname.replace(/frmPopup/, "fraGenericFrame");            
            window.showModalDialog(frmGeneric + '?Title=' + title + '&PageAndParams=' + frmname + '?ParentID=-1?Context=' + params,'','dialogwidth: ' + w + 'px; dialogheight: ' + h + 'px; status: 0; scroll: 1; help: 0; center:yes;');
        }   
    }
    catch(error)
    {
        window.alert('Cannot display the pop-up window. You may need to disable your Pop-Up blocker.');
    }
}

function changeImageURL(sHRef, sImageUrl, lblArrowsId, img, lnk) {
    var imgname;
    var lnkname;
    imgname = document.getElementById(img);
    lnkname = document.getElementById(lnk);
    
    imgname.src = sImageUrl;
    imgname.title = "";
    lnkname.href = sHRef;
    document.getElementById(lblArrowsId).style.display = 'block';
}

function hideArrow(lblArrowsId)
{
    document.getElementById(lblArrowsId).style.display = 'none';
}

function fixIE6Flicker() {
    //-- for IE6 but not IE7, Moz, Safari, Opera...
    //-- for IE6 but not IE7, Moz, Safari, Opera...
	var m = document.uniqueID /*IE*/ 
	&& document.compatMode /*>=IE6*/ 
	&& !window.XMLHttpRequest /*<=IE6*/ 
	&& document.execCommand ; 
    try {
   	    if (!!m) {
	        document.execCommand('BackgroundImageCache', false, true);
	    }
    } catch(e) {}
}
