// JavaScript Document

//EXPANDABLE BLOCKES SCRIPT -START

exBlockStyleDeclaration='.expandable-block{display:none;} .show-rotation-block{display:none !important;}';
exBlockLinkObject={};

//Constructor for exBlockActionLinksList objects
function exBlockActionLink(exBlockCssDeclaration,exBlockLinkCls,exBlockLinkOpn){
exBlockStyleDeclaration+=exBlockCssDeclaration;
this.exBlockLinkClosed=exBlockLinkCls;
this.exBlockLinkOpened=exBlockLinkOpn;
exBlockLinkObject[exBlockLinkOpn]=this;
}

exBlockActionLinksPlus=new exBlockActionLink('a.closed-plus-default span{background: url(/common/img/links/closed-plus.gif) 0 50% no-repeat;} a.closed-plus-default:hover span {background-position: -42px 50%;}','closed-plus','opened-minus');
exBlockActionLinksHighlight=new exBlockActionLink('#content a.closed-plus-highlight-default span{background: url(/eshop/content/common/closed-highlight.gif) 0 50% no-repeat;} #content a.closed-plus-highlight-default:hover span {background-position: -42px 50%;}','closed-plus-highlight','opened-minus-highlight');

//Define the default action link class
//Check DOM support
if (document.getElementById && document.createTextNode){
if(document.createStyleSheet){
//If IE
expandableBlockNewStyleSheet = document.createStyleSheet("");
expandableBlockNewStyleSheet.cssText=exBlockStyleDeclaration;
}else{
//If Not IE
var exBlockhead=document.getElementsByTagName("head")[0];
expandableBlockStyleNode = document.createElement("style");
expandableBlockStyleNode.appendChild(document.createTextNode(exBlockStyleDeclaration));
exBlockhead.appendChild(expandableBlockStyleNode);
}
}
//Expandable blocks switcher
function expandableBlockSwitcher(element){
var parentBlock=element;
var lastParentBlock=element;
var block;
var pass=false;
var extraclasses;
var signClosed;
var signOpened;
//Check DOM support
if (document.getElementById && document.createTextNode){
//If sign Closed & Opened not found in function parameters- START
if(!signOpened || !signClosed){
if(!element.openedLink){
var linkClass=element.className.split (' ');
if(linkClass.length>1){
if(linkClass[0].length>0 && linkClass[1].indexOf('default')){
element.openedLink=linkClass[0];
//If sign Closed & Opened not found in the function parameters search in object actionLinksList
if(exBlockLinkObject[linkClass[0]]){
element.closedLink=exBlockLinkObject[linkClass[0]].exBlockLinkClosed;
}}}}

if(element.closedLink && element.openedLink){
signOpened=element.openedLink;
signClosed=element.closedLink;
}
}
//If sign Closed & Opened not found in function parameters- END

//find parent tag with class expandable-group
for (i = 0; i < 100; i++) {
parentBlock=parentBlock.parentNode;

if(parentBlock.className.indexOf('expandable-group')!=-1){break; }
lastParentBlock=lastParentBlock.parentNode;
}
//find expandable-block after the link switcher
for (i = 0; i < parentBlock.childNodes.length; i++) {
if(parentBlock.childNodes[i]==lastParentBlock)pass=true;
if(parentBlock.childNodes[i].tagName && pass){
block=parentBlock.childNodes[i];
if(block.className.indexOf('expandable-tag')!=-1 || block.className.indexOf('expandable-block')!=-1 )break;
}
}
//IF expandable-block  found
if(block){
if(!block.extraclass){
block.extraclass='';
extraclasses=block.className.split (' ');
//Find some extra classes defined in expandable-block class defenition
for (i = 0; i < extraclasses.length; i++) {
if(extraclasses[i].length>0 && extraclasses[i].indexOf('expandable-block')==-1 && (extraclasses[i].indexOf("expandable-tag")==-1) && extraclasses[i].indexOf("hide-block")==-1 && extraclasses[i].indexOf("show-block")==-1)block.extraclass+=extraclasses[i]+' ';
}
if(block.extraclass.length>1)block.extraclass=' '+block.extraclass;
}

//Open and Close operations 
if(block.className.indexOf("expandable-tag")!=-1 && block.className.indexOf("show-block")!=-1){
block.className='expandable-tag hide-block'+block.extraclass;
if(signOpened){
element.className =signClosed;
element.title='Click to display the content';
}
}else{
if(block.className.indexOf("expandable-tag")!=-1  || block.className.indexOf("expandable-block")!=-1){
block.className='expandable-tag show-block'+block.extraclass;
if(signClosed){
element.className = signOpened;
element.title='Click to hide the content';
}
}
}}}
return false;}
//EXPANDABLE BLOCKES SCRIPT -END

//EXPANDABLE BLOCKES FOR FAQ LIST
function expandFAQListCrutch(element){ 
	applyCurrentClass(element);
	expandableBlockSwitcher(element);
	return false;
	}
	
function applyCurrentClass(element){ 
	var parentBlock=element;
		for (i = 0; i < 100; i++) {
parentBlock=parentBlock.parentNode;

if(parentBlock.className.indexOf('expandable-group')!=-1){

if(parentBlock.className.indexOf(' current')!=-1){
	parentBlock.className='expandable-group';
	}else{
	parentBlock.className='expandable-group current';
	}
break;
}}
return false;
	}