
function ssApplySelectorSwapTags(selectorname, imagefile, bgcolor, attach, repeat, pos){

	var tags = document.getElementsByTagName(selectorname)
	
	for (var x=0; x<tags.length; x++){

		var estyle = tags[0].style;
		
		if(imagefile != ''){
			estyle.backgroundImage = 'url('+imagefile+')';
		}
		if(bgcolor != ''){
			estyle.backgroundColor = bgcolor;
		}
		if(attach != ''){
			estyle.backgroundAttachment = attach;
		}
		if(repeat != ''){
			estyle.backgroundRepeat = repeat;
		}
		if(pos != ''){
			estyle.backgroundPosition = pos;
		}
	}
}

function ssApplySelectorSwapCSS(selectorname, imagefile, bgcolor, attach, repeat, pos) {

	if (!document.styleSheets) return;
	for (i=0; i < document.styleSheets.length; i++)
	{
		var theRules = new Array();
		if (document.styleSheets[i].cssRules)
			theRules = document.styleSheets[i].cssRules
		else if (document.styleSheets[i].rules)
			theRules = document.styleSheets[i].rules
		else return;
		
		for (c=0; c < theRules.length; c++)	{
			if(theRules[c].selectorText == selectorname){
				if(imagefile != ''){
					theRules[c].style.backgroundImage = 'url('+imagefile+')';
				}
				if(bgcolor != ''){
					theRules[c].style.backgroundColor = bgcolor;
				}
				if(attach != ''){
					theRules[c].style.backgroundAttachment = attach;
				}
				if(repeat != ''){
					theRules[c].style.backgroundRepeat = repeat;
				}
				if(pos != ''){
					theRules[c].style.backgroundPosition = pos;
				}
			}
		}//end for
	}//end for
}

function ssApplySwap(call){
	for (var x=0; x<sslist.length; x++)
	{
		if(!sslist[x][6]){	
			if(sslist[x][7] == 1) {
				ssApplySelectorSwapCSS(sslist[x][0], sslist[x][1], sslist[x][2], sslist[x][3], sslist[x][4], sslist[x][5]);
				sslist[x][6] = true;
			}
			if(call == 2){
				ssApplySelectorSwapTags(sslist[x][0], sslist[x][1], sslist[x][2], sslist[x][3], sslist[x][4], sslist[x][5]);
				sslist[x][6] = true;
			}
		}
	}

}
