function FCKValue(id)
{
    var temp = document.createElement('txBuffer');
    temp.value = FCKeditorAPI.GetInstance(id).GetXHTML();
    return temp;
}

function $() {
        
	if (arguments.length>1) {
		return false;
	}
	if (arguments.length<1) {
		return false;
	}

	var element = arguments[0];

    if (typeof element == 'string') {
        if (document.getElementById) 
        {
            try 
            {
                element = FCKValue(element);
            }
            catch(err)
            {
                element = document.getElementById(element);            
            }

        } else if (document.all) {
            element = document.all[element];
        }
    }
    
	
	return element;
}

//<![CDATA[
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
       anchor.target = "_blank";
 }
}
window.onload = externalLinks;
//]]>

function focusOn(elem)
{
	elem.style.border = "1px #0075c5 solid";
}

function focusOff(elem)
{
	elem.style.border = "1px #999999 solid";
}

function setFocus(elem)
{
	document.getElementById(elem).focus();
}



function toggleBoxSelection(l,hl)
{
	for (i=1;i<=5;i++)
		{
			document.getElementById('l'+i).className='listInfo dN';
			document.getElementById('hl'+i).style.borderBottom='0px #E3E3E3 solid';
		}
	document.getElementById(l).className='listInfo dB';
	document.getElementById(hl).style.borderBottom='1px #E3E3E3 solid';
}


function toggleMenuSelection(subl)
	{
		var i=1;
		if (document.getElementById(subl).className=='lisub dB') 
			{
				document.getElementById(subl).className='lisub dN';
			}
		else if (document.getElementById(subl).className!='lisub dB')
				{
					while ($("l"+i.toString())!=null) 
						{ 
							document.getElementById('subl'+i).className='lisub dN';
							i++;
						}
					document.getElementById(subl).className='lisub dB';		
				}
	}


function changePicture(idx, path, alt, title, largePhotoPath)
{
    $("photo0").className = 'photoThumbnail';	
	$($("hSelectedPhoto").value).className = 'photoThumbnail';
	$("hSelectedPhoto").value = 'photo' + idx;
	$($("hSelectedPhoto").value).className = 'photoThumbnail selected';
	$("productImgLarge").src = path;
    $("productImgLarge").alt = path;
    $("productImgLarge").title = path;
    $("photoLarge").href = largePhotoPath;
}
function isCompany()
{
    //console.log($("ckIsCompany").checked);
    if ($("ckIsCompany").checked)
    {   
        $("dvCompany").className ="";
    }
    else
    {
        $("dvCompany").className ="dN";
    }
}