﻿/*
var x;
var x1;

var cX = 0; var cY = 0; var rX = 0; var rY = 0;
var ActiveWokno = null;

function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}

if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }

function AssignPosition(d) 
{
    //alert(document.documentElement.scrollTop);
    //alert(document.documentElement.scrollLeft);
    if(self.pageYOffset) 
    {
        //alert('a');
	    //rX = self.pageXOffset;
	    //rY = self.pageYOffset;
	}
    else if(document.documentElement && document.documentElement.scrollTop) 
    {
        //alert('b');
	    rX = document.documentElement.scrollLeft;
	    rY = document.documentElement.scrollTop;
	}
    else if(document.body) 
    {
        //alert('c');
	    //rX = document.body.scrollLeft;
	    //rY = document.body.scrollTop;
	}
    if(document.all) 
    {
        //alert('d');
	    cX += rX; 
	    cY += rY;
	}
    d.style.left = (cX-738) + "px";
    d.style.top  = (cY-391) + "px";
}

function HideContent(d) 
{
    if(d.length < 1) { return; }
    document.getElementById(d).style.display = "none";
}

function ShowContent(d) 
{
    if (ActiveWokno != null) 
        HideContent(ActiveWokno);
    ActiveWokno = d;
    if(d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd);
    dd.style.display = "block";
}

function ReverseContentDisplay(d) 
{
    if(d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd);
    if  (dd.style.display == "none") 
        { dd.style.display = "block"; }
    else { dd.style.display = "none"; }
}
*/
var SkipCheck = false;

function SetRightFlash()
    {
	var flashHTML = "";
	flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="166" height="293">';
	flashHTML += '<param name="movie" value="http://10.0.0.44/newWeb/Img/WEB/Microsoft14.swf"/>';
        /* mm061212 disabled to get right validation
	flashHTML += '<embed height="293" width="200">';
	    flashHTML += '<param name="src"                 value="http://10.0.0.44/newWeb/Img/WEB/Microsoft14.swf" />';
	    flashHTML += '<param name="wmode"               value="transparent" />';
	    flashHTML += '<param name="loop"                value="true" />';
	    flashHTML += '<param name="menu"                value="false" />';	
	    flashHTML += '<param name="quality"             value="high" />';
	    flashHTML += '<param name="bgcolor"             value="#ffffff" />';
	    flashHTML += '<param name="name"                value="banner" />';
	    flashHTML += '<param name="align"               value="middle" />';
	    flashHTML += '<param name="allowScriptAccess"   value="sameDomain" />';
	    flashHTML += '<param name="type"                value="application/x-shockwave-flash" />';
	    flashHTML += '<param name="pluginspage"         value="http://www.macromedia.com/go/getflashplayer" />';
	flashHTML += '</embed>';
	061212mm end */ 
	flashHTML += '</object>';

    document.getElementById("rightflash").innerHTML = flashHTML;
}

function Chose_New()
{
    /*
    if (document.getElementById("rblAccountType_0").checked == true)
        window.location = "NewUser.aspx?ID=1"
    else
       window.location = "NewUser.aspx?ID=2"
       document.getElementById("FormLogin").submit(); 
       */
       if (document.getElementById("rblAccountType_0").checked == true)
           window.location = "NewUser.aspx?ID=1"
       if (document.getElementById("rblAccountType_1").checked == true)      
        window.location = "NewUser.aspx?ID=2"
//       if (document.getElementById("rblAccountType_2").checked == true)
//        document.getElementById("FormLogin").submit(); 

//    if (document.getElementById("rblAccountType_0").checked == true)
//    {
//        document.getElementById("FormAction").value = "ACC1";
//        document.getElementById('FormLogin').submit();
//    }
//    if (document.getElementById("rblAccountType_1").checked == true)
//    {
//        document.getElementById("FormAction").value = "ACC1";
//        document.getElementById('FormLogin').submit();
//    }
    if (document.getElementById("rblAccountType_2").checked == true)
    {
        document.getElementById("FormAction").value = "EPS";
        document.getElementById('FormLogin').submit();
    }
    if ((document.getElementById("rblAccountType_0").checked == false) && (document.getElementById("rblAccountType_1").checked == false)
      && (document.getElementById("rblAccountType_2").checked == false))
    alert('Please chose ...');
}

function CheckForgottenPassword()
{
    if (document.getElementById("tbEmail").value == '')
    {
        alert ("Please enter your e-mail address.");
        return false;
    }
    document.getElementById("FormAction").value = "CheckForgottenPassword";
    document.getElementById('FormLogin').submit()
    return true;
}

function CheckLogin()
{
    if (document.getElementById("tbEmail").value == '')
    {
        alert ("Please enter your e-mail addres.");
        return false;
    }
    document.getElementById("FormAction").value = "Login";
    document.getElementById('FormLogin').submit()
    return true;
}

function CheckSendPassword()
{
    if (document.getElementById("tbEmail").value == '' && document.getElementById("tbUserName").value == '')
    {
        alert ("Please enter your login name or e-mail addres.");
        return false;
    }
    document.getElementById("FormAction").value = "SendPassword";
    document.getElementById('Form1').submit()
    return true;
}

function SortedBy_TheSame(who)
{
    var sort1 = document.getElementById("Sortedby1");
    var sort2 = document.getElementById("Sortedby2");
    if (who == sort1) sort2.value = who.value;
    if (who == sort2) sort1.value = who.value;
    document.getElementById("MainForm").submit();
}

function Prodact_Page__CheckBoxClick(who)
{
    if (x == null) x = 0;
    if (x1 == null) x1 = 0;
    x1 = x1 + 1;
    if (who.checked)
    {
        x = x + 1;        
        document.getElementById('Selected_Item').value = document.getElementById('Selected_Item').value + '; x = ' + x1 + ',value = ' + who.name;
    }
    else
    {
        x = x - 1;
        if (x < 0) x = 0;
        document.getElementById('UnSelected_Item').value = document.getElementById('UnSelected_Item').value + '; x = ' + x1 + ',value = ' + who.name;
    }
}

function Prodact_Page__CheckBoxCheck()
{
    if ((x == null) || (x < 2)) 
    {
        alert('At least TWO items is required. Please select at least TWO item.');
        return false;
    }
    if (x > 4) 
    {
        alert('Too many items is selected, max. 4 items is allowed');
        return false;
    }
    return true;
}

function Prodact_Page__Compare()
{
    document.getElementById('MainForm').action  = 'Compare.aspx?' + document.getElementById('Query').value;
    document.getElementById('MainForm').submit();
}

function Prodact_Page__AddToBasketCheck()
{
    if ((x == null) || (x < 1)) 
    {
        alert('At least ONE items is required. Please select at least ONE item.');
        return false;
    }
    return true;
}

function Prodact_Page__AddToBasket()
{
    document.getElementById('MainForm').action  = 'BasketCheck.aspx?' + document.getElementById('Query').value;
    document.getElementById('MainForm').submit();   
}

function PrintPage()
{
    window.print();
}


var w3c=(document.getElementById)?true:false;
var ie= (document.all)? true: false;
var N=-1;

function createBar(w,h,bgc,brdW,brdC,blkC,speed,blocks,count,action)
{
    if(ie||w3c)
    {
        var t='<div id="_xpbar'+(++N)+'" style="visibility:visible; position:relative; overflow:hidden; width:'+w+'px; height:'+h+'px; background-color:'+bgc+'; border-color:'+brdC+'; border-width:'+brdW+'px; border-style:solid; font-size:1px;">';
        t+='<span id="blocks'+N+'" style="left:-'+(h*2+1)+'px; position:absolute; font-size:1px">';
        for(i=0;i<blocks;i++)
        {
            t+='<span style="background-color:'+blkC+'; left:-'+((h*i)+i)+'px; font-size:1px; position:absolute; width:'+h+'px; height:'+h+'px; '
            t+=(ie)?'filter:alpha(opacity='+(100-i*(100/blocks))+')':'-Moz-opacity:'+((100-i*(100/blocks))/100);
            t+='"></span>';
        }
        t+='</span></div>';
        {
            document.write(t);
            var bA=(ie)?document.all['blocks'+N]:document.getElementById('blocks'+N);
            bA.bar=(ie)?document.all['_xpbar'+N]:document.getElementById('_xpbar'+N);
            bA.blocks=blocks;
            bA.N=N;
            bA.w=w;
            bA.h=h;
            bA.speed=speed;
            bA.ctr=0;
            bA.count=count;
            bA.action=action;
            bA.togglePause=togglePause;
            bA.showBar=function()
            {
                this.bar.style.visibility="visible";
            }
            bA.hideBar=function()
            {
                this.bar.style.visibility="hidden";
            }
            bA.tid=setInterval('startBar('+N+')',speed);
            return bA;
        }
    }
}
//function createBar()
//{
////    
//}

function startBar(bn)
{
    var t=(ie)?document.all['blocks'+bn]:document.getElementById('blocks'+bn);
    if(parseInt(t.style.left)+t.h+1-(t.blocks*t.h+t.blocks)>t.w)
    {
        t.style.left=-(t.h*2+1)+'px';
        t.ctr++;
        if(t.ctr>=t.count)
        {
        eval(t.action);
        t.ctr=0;
        }
    }
    else 
    t.style.left=(parseInt(t.style.left)+t.h+1)+'px';
}

function togglePause()
{
    if(this.tid==0)
    {
        this.tid=setInterval('startBar('+this.N+')',this.speed);
    }
    else
    {
    clearInterval(this.tid);
    this.tid=0;
    }
}

function togglePause()
{
    if(this.tid==0)
    {
        this.tid=setInterval('startBar('+this.N+')',this.speed);
    }
    else
    {
        clearInterval(this.tid);
        this.tid=0;
    }
}

    var xmlHttp;
    
    function Create_Request()
    {
        try { xmlHttp   = new ActiveXObject("Msxml2.XMLHTTP.4.0");  return;}catch(ex) {}
        try { xmlHttp   = new ActiveXObject("MSXML2.XMLHTTP");      return;}catch(ex) {}
        try { xmlHttp   = new ActiveXObject("Microsoft.XMLHTTP");   return;}catch(ex) {}
        try { xmlHttp   = new XMLHttpRequest();                     return;}catch(ex) {}
        alert("Can't create XMLHP object !");
    }
    
    function Send_HSBC_Request()
    {
        if (window.location.search.length == 0)
        {
            Create_Request();
            var url = "HSBC_Request.asmxa";
            xmlHttp.open("GET",url, true);
            xmlHttp.onreadystatechange = HSBC_Request_Back;
            xmlHttp.send(null);
        }
    }
    
    function HSBC_Request_Back()
    {
        if (xmlHttp.readyState == 4) 
        {
            if (xmlHttp.status == 200)
            {
                if ((xmlHttp.responseText != '0') && (xmlHttp.responseText != '1') && (xmlHttp.responseText != '3'))
                    window.location = xmlHttp.responseText;
                else
                    window.location = window.location.href + "?ErrorInAPI=" + xmlHttp.responseText;
            }
        }
    }   

    function Send_Refresh_Request()
    {
        if (window.location.search.length == 0) //PageQuery...
        {
            Create_Request();
            var rand_no = Math.random();
            rand_no = rand_no * 100;
            var url = "HSBC_Request.asmxa?Referesh=1&Rand=" + rand_no;
            xmlHttp.open("GET",url, true);
            //xmlHttp.onreadystatechange = Refresh_Request_Back;
            xmlHttp.send(null);
            setTimeout(function(){Send_Refresh_Request();}, 300000);
        }
    }
    
    function checkemail(EmailAddress)
    {
        var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
        if (filter.test(EmailAddress))
        {
            testresults=true;
        }
        else
        {
            alert("Please input a valid email address!")
            testresults=false
        }
        return (testresults)
    }
        
    function CheckFields(param, message)
    {
        if (SkipCheck) { SkipCheck = false; return true};
        var item_array = param.split(";");
        var AllInputsSelected = true;
        var x = 0;
        for (x = 0; x < item_array.length; x++)
        {   
            //alert(document.getElementById(item_array[x]).type);
            if (document.getElementById(item_array[x]).type == 'select-one')//osetreni pro drill down boxy
            {
                if (document.getElementById(item_array[x]).selectedIndex == 0)
                {
                    document.getElementById(item_array[x]).style.backgroundColor = 'OldLace';
                    document.getElementById(item_array[x]).style.borderColor     = '#DA3728';
                    AllInputsSelected = false;
                }
                else
                {
                    document.getElementById(item_array[x]).style.backgroundColor = '';
                    document.getElementById(item_array[x]).style.borderColor     = '';
                }
            }
            else if ((document.getElementById(item_array[x]).type == 'text') 
                  || (document.getElementById(item_array[x]).type == 'password')
                  || (document.getElementById(item_array[x]).type == 'textarea')) // osetreni pro textboxy
            {
                if (document.getElementById(item_array[x]).value == '')
                {
                    document.getElementById(item_array[x]).style.backgroundColor = 'OldLace';
                    document.getElementById(item_array[x]).style.borderColor     = '#DA3728';
                    AllInputsSelected = false;
                }
                else
                {   
                    document.getElementById(item_array[x]).style.backgroundColor = '';
                    document.getElementById(item_array[x]).style.borderColor     = '';
                }

            }
            else if (document.getElementById(item_array[x]).type == 'checkbox')
            {
                if(!document.getElementById(item_array[x]).checked)
                {
                    AllInputsSelected = false;
                    document.getElementById(item_array[x]).style.backgroundColor = 'OldLace';
                    document.getElementById(item_array[x]).style.borderColor     = '#DA3728';
                }
                else
                {
                    document.getElementById(item_array[x]).style.backgroundColor = '';
                    document.getElementById(item_array[x]).style.borderColor     = '';
                }                
            }
            else if (document.getElementById(item_array[x] + "_0").type == 'radio') // osetreni pro radiobutton
            {
                //alert(document.getElementById(param));
                //else if (document.getElementsByName(item_array[x].replace(/_/g, "$")).length > 0)
                var name = item_array[x].replace(/_/g, "$");
                var RadioButtonList = document.getElementsByName(name);
                var AtLeastOne = false;
                for (var y = 0; y < RadioButtonList.length; y++)
                    if (RadioButtonList[y].checked)
                        AtLeastOne = true;
                if (AtLeastOne == false)
                {
                    AllInputsSelected = false;
                    for (var y = 0; y < RadioButtonList.length; y++)
                    {
                        RadioButtonList[y].style.backgroundColor = 'OldLace';
                        RadioButtonList[y].style.borderColor     = '#DA3728';
                    }
                }
                else
                    for (var y = 0; y < RadioButtonList.length; y++)
                    {
                        RadioButtonList[y].style.backgroundColor = '';
                        RadioButtonList[y].style.borderColor     = '';
                    }                    
            }
        }
        if (!AllInputsSelected)
        {
            alert(message);
            return false;
        }
        return true;
    }

    function CompareFieldsToSomeValue(Field1, Field2, message)
    {
        if (document.getElementById(Field1).value != document.getElementById(Field2).value)
        {
            alert (message);
            return false;
        }
        return true;
    }

    function CheckFieldsForLength(Field, minlen, maxlen, message)
    {
        var Value = document.getElementById(Field).value.replace(/^\s+|\s+$/g, '');
        if ((Value.length < minlen) || (Value.length > maxlen))
        { 
            alert(message);
            return false; 
        }
        return true;
    }    
       
   function EmailValidator(str, message)
   {
        var  exp = /^[_a-zA-Z0-9\.\-&]+@[_a-zA-Z0-9\.\-&]+\.[a-zA-Z]{2,4}$/;
        var  value = document.getElementById(str).value;
        if (!value.match(exp)) 
        {
            alert('Invalid format of email address!');
            return false;
        }
        return true;
    }

    
    function ApplyPasswordTester(Field)
    {
        var value = document.getElementById(Field).value.replace(/^\s+|\s+$/g, '');
        if (value.length < 8)
        {
            alert('Password must have at least 8 characters.');
            return false;
        }
        if (!value.match('[0-9]{1}'))
        {
            alert('Password must have at least one number');
            return false;
        }
        if (!value.match('[\]\[(){}:"|:;"\'~`<>?-_+=/.!]'))
        {
            alert('Password must have at least one special char(][(){}:"|:;"\'~`<>?-_=+/.!)');
            return false;
        }
        return true;
    }
    
    function MyIsNumber(Field, message)
    {
        var value = document.getElementById(Field).value;
        if (value.match('^[+-]?[0-9]{1,}[.]{0,}[0-9]{0,}$'))
            return true;
        else
        {
            alert(message);
            return false;
        }
    }
    
    function RadioIsSelected(Radio1, Radio2, Message)
    {
        var name = Radio1.replace(/_/g, "$");
        var RadioButtonList1 = document.getElementsByName(name);
        name = Radio2.replace(/_/g, "$");
        var RadioButtonList2 = document.getElementsByName(name);
        var AtLeastOne = false;
        for (var y = 0; y < RadioButtonList1.length; y++)
            if (RadioButtonList1[y].checked)
                AtLeastOne = true;

        if (AtLeastOne == false)
        for (var y = 0; y < RadioButtonList2.length; y++)
            if (RadioButtonList2[y].checked)
                AtLeastOne = true;
        
        if (AtLeastOne == false)
        {
            for (var y = 0; y < RadioButtonList1.length; y++)
            {
                RadioButtonList1[y].style.backgroundColor = 'OldLace';
                RadioButtonList1[y].style.borderColor     = '#DA3728';
            }
            for (var y = 0; y < RadioButtonList2.length; y++)
            {
                RadioButtonList2[y].style.backgroundColor = 'OldLace';
                RadioButtonList2[y].style.borderColor     = '#DA3728';
            }
            alert(Message);
            return false;
        }
        else
        {
            for (var y = 0; y < RadioButtonList1.length; y++)
            {
                RadioButtonList1[y].style.backgroundColor = '';
                RadioButtonList1[y].style.borderColor     = '';
            }
            for (var y = 0; y < RadioButtonList2.length; y++)
            {
                RadioButtonList2[y].style.backgroundColor = '';
                RadioButtonList2[y].style.borderColor     = '';
            }        
        }
        return true;
    }
    
    function ClearFileds(Item)
    {
        document.getElementById(Item).value = '';
        return true;
    }
    
    /*
    function PermCheckImageBox(d)
    {
//        if(d.length < 1) { return; }
//        if (document.getElementById(d).checked == true)
//            document.getElementById(d).checked = false;
//        else
//            document.getElementById(d).checked = true;
        
        if (document.getElementById(d).checked == true)
            document.getElementById(d).checked = false;
        else
            document.getElementById(d).checked = true;
        .CommandArgument
        
        //document.getElementById(d).style.ImageUrl = "none";
        alert(document.getElementById(d).checked);
    }
    */
    
    function PermCheckImageBox(d,check)
    {
    //if (d.src.search('tick-blue.gif')>-1)
    if (document.getElementById(check).value==1)
        {
            d.src = d.src.replace("tick-blue.gif", "cross-red.gif");
            document.getElementById(check).value = 0;
        }
        else
        {
           d.src = d.src.replace("cross-red.gif", "tick-blue.gif");
           document.getElementById(check).value = 1;
        }
    }
    
    function NumberInRange(val, min, max, message1, message2)
    {
        var value = document.getElementById(val).value;
        if (!MyIsNumber(val,message1)) return false;
        if ((value >= min) && (value <= max))
        {
            return true;
        }
        else
        {
            alert(message2);
            return false;
        }
    }
    
    function isDate(Field, Message)
    {
        input = document.getElementById(Field).value;
        if (input.value == undefined) input = document.getElementById(Field);
        if (input.value == "") return true;
        d = input.value;
        d = eraseBlank(d);                                 // odstranění blank znaků
                                                       // převod na ISO formát
        d = d.replace(/^(\d{1,2})\D(\d{1,2})\D(\d{4})$/, '$3-$2-$1');
        d = d.replace(/^(\d{1,2})\D(\d{1,2})\D(\d{2})$/, '20$3-$2-$1');
        d = d.replace(/^(\d{2})\D(\d{1,2})\D(\d{1,2})$/, '20$1-$2-$3');
                                                        // ISO: yyyy-(m)m-(d)d
        reg = /^(\d{4})-(0?[1-9]|1[0-2])-(0?[1-9]|[12]\d|3[01])$/;
        if (reg.test(d)
          && (                                                  // měsíce s 30 dny
               ((RegExp.$2 == 4 || RegExp.$2 == 6 || RegExp.$2 == 9 || 
                 RegExp.$2 == 11) && RegExp.$3 < 31)
               ||                                               // měsíce s 31 dny
               ((RegExp.$2 == 1 || RegExp.$2 == 3 || RegExp.$2 == 5 || 
                 RegExp.$2 == 7 || RegExp.$2 == 8 || RegExp.$2 == 10 ||
                 RegExp.$2 == 12) && RegExp.$3 < 32)
               ||                                                          // únor
               (RegExp.$2 == 2 && RegExp.$3 < 29)
               ||                                          // únor - přestupný rok
               (RegExp.$2 == 2 && RegExp.$3 < 30 && ((RegExp.$1 % 100) == 0 || 
                             (RegExp.$1 % 4) == 0 || (RegExp.$1 % 400) == 0))
             ) 
         ) 
         {
            d = d.replace(/-(\d)-/, '-0$1-');   // doplnění nul u měsíců a dní
            d = d.replace(/-(\d)$/, '-0$1');
            input.value = d;                    // uložení upraveného formátu
	        return true;
         } 
         else
         {
            input.select();                     // chybný čas
            input.focus();
            alert(Message);
	        return false;
         }
    }
    
    function eraseBlank(text)
    {
        text = text.replace(/^\s*/, '');        // odstranění blank znaků na zažátku
        text = text.replace(',', '.');
        return text = text.replace(/\s*$/, '');                   // a konci řetězce
    }


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
} 


var glob_left_container, glob_product_container
function SetProductContainerID(param1, param2)
{
    glob_product_container = param1;
    glob_left_container = param2;
    /*alert(glob_left_container);*/
    //alert('set');
    return;
}

function ResizeSalesWidth(){
          
          var winW;

          if (navigator.appName=="Netscape")
          {
          winW = window.innerWidth;
          }
          if (navigator.appName.indexOf("Microsoft")!=-1)
          {
          winW = document.body.clientWidth;
          }
          
          //var center   = document.getElementById(glob_left_container);  //"ctl00_ContentPlaceHolder1_ProductPage1_RedefineItem");
          //var maincont   = document.getElementById(glob_product_container);  //"ctl00_ContentPlaceHolder1_MainProductContainer");
          var center   = document.getElementById("ctl00_ContentPlaceHolder1_ProductPage1_RedefineItem");
          var maincont   = document.getElementById(glob_product_container); //"ctl00_ContentPlaceHolder1_MainProductContainer");
          
          center.style.width = document.body.clientWidth - 520;
          maincont.style.width = '' + document.body.clientWidth - 350 +'px';
          /*alert(glob_left_container);*/
          //alert('resize');
          var left   = document.getElementById(glob_left_container);
          //alert(glob_left_container);
          //left.style = "margin-left: -1100px;";
          
          left.style.marginLeft = ''-winW + 194;//-document.body.clientWidth + 194;
          //left.style.marginLeft = ((string) (-winW ))+'px';

          var WString = '';
          WString = ''+ (-winW + 194);
          WString = WString + 'px';
          
          //alert(WString);
          left.style.marginLeft= WString;
          //left.style.marginLeft = -100;
          //left.style = "margin-left: -1100px;"
          return;
          
          /*alert(center.style.width);*/
          
          /*
          var center   = document.getElementById("full_page");
          var leftMenu = document.getElementById("left");
          var rightMenu = document.getElementById("left");
          var winW,winH;

          if (navigator.appName=="Netscape")
          {
          winW = window.innerWidth;
          winH = window.innerHeight;
          }
          if (navigator.appName.indexOf("Microsoft")!=-1)
          {
          winW = document.body.clientWidth;
          winH = document.body.clientHeight;
          }
          //window.status = winW - (leftMenu.clientWidth + center.clientWidth) + "px;" + leftMenu.clientWidth + "px";

          
          if (winW &lt; (leftMenu.clientWidth + center.clientWidth + rightMenu.clientWidth))
          {
          if (((winW - (leftMenu.clientWidth + center.clientWidth + rightMenu.clientWidth))/2) &gt; -180)
          center.style.left = ((winW - (leftMenu.clientWidth + center.clientWidth + rightMenu.clientWidth))/2) + "px";
          }
          else
          center.style.left = "0px";

          //window.status = window.status + ";" + center.style.left;
          */
}

function BrandsListSupport(alllist, leters)
{
    document.getElementById('allbrandslink1').style.visibility = "visible";
    document.getElementById('allbrandslink2').style.visibility = "visible";
    document.getElementById(leters).style.visibility = "hidden";
    document.getElementById(alllist).style.visibility = "hidden";
    return true;
}

function SearchText(obj, empty)
{
    if (empty)
    {
        obj.value='';
    }
    else
    {
        if (obj.value=='')
        {
            obj.value='Enter keyword(s) / code';
        }
    }
}

function AccountSearch(obj, longer)
{
    textobj = document.getElementById('LoggedInAs');
    if (longer)
    {
        obj.style.width= "350px";
        textobj.style.display = "none";
    }
    else
    {
        obj.style.width= "250px";
        textobj.style.display = "inline-block";
    }
}

function SaveMenuIdToCookie(menuid)
{
    document.cookie = 'menuid=' + menuid;
}

function JavascriptEnabled()
{
    document.cookie = 'javascriptenabled=1';
}
