//pink two_column_right

function initStyle(){
	if(typeof(doLoaded) != "undefined"){doLoaded();}


	insertHTML('banner-body','<div style="width:1px;height:100px;overflow:hidden;float:left;">&nbsp;</div><div>');

	insertHTML2('banner-body','</div><h2 style="height:1px;width:100px;margin:0px;padding:0px;overflow:hidden;clear:both;">&nbsp;</h2>');

}

// inner function
function getclassBrowser(){
	var ua=navigator.userAgent;
	var classname;
    if(ua.match(/MSIE/) != null){
		classname = 'className';
	}
	else{
		classname = 'class';
	}
	return classname;
}

function changeString2(node, tag, string, whichcase, insertIndex, id){

	var classId = id;
    var tagcount = 0;
    var tmpIndex=0;
    
	if(!id || id.length == 0){
		classId = '';
	}

	while(node){
		if(node.firstChild){
			if(node.id == classId){
				if(changeString2(node.firstChild, tag, string, whichcase, insertIndex, id) == -1){
					return -1;
				}
			}
		}
		// 入れ替え対象タグ
		if(node.nodeName.toLowerCase() == tag.toLowerCase()){
			changestr(node, string, whichcase, insertIndex);
			return -1;
		}
		node = node.nextSibling;
    }
}

function changeString(node, tag, string, whichcase, insertIndex, id){

	var classId = id;
    var tagcount = 0;
    var tmpIndex=0;
    
	if(!id || id.length == 0){
		classId = '';
	}

	while(node){
		if(node.firstChild){
			if(node.id == classId){
				changeString(node.firstChild, tag, string, whichcase, insertIndex, id);
			}
		}
		// 入れ替え対象タグ
		if(node.nodeName.toLowerCase() == tag.toLowerCase()){
			changestr(node, string, whichcase, insertIndex);
		}
		node = node.nextSibling;
    }
}


function changestr(node, string, whichcase, insertIndex){

	// replace
	if(whichcase == 1){
		node.innerHTML =string;
	}
	// insert
	else{
    	tmpIndex=insertIndex;
		if(insertIndex == -1 || insertIndex > node.innerHTML.length){
			tmpIndex = node.innerHTML.length;
		}
		var str = node.innerHTML;
       	node.innerHTML =str.substring(0, tmpIndex) + string + str.substring(tmpIndex);
	}
}


// Common Javascript
var themeBaseURI = 'http://exaple.org/specialstyles';

// put image and flash files to themeBaseURI/THEME/
//  filename should be THEME-CLASSNAME.gif or THEME-ID.swf.
//  like mybow-comment.gif and mybow-recent-updates.swf

function insertFlashMovie (theme, divs) {
    for (i in divs) {
        var swfURL = themeBaseURI + '/' + theme + '/' + theme + '-' + divs[i] + '.swf';
        insertHTML(divs[i], '<embed src="' + swfURL + '" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" TYPE="application/x-shockwave-flash" </embed>');
    }
}

function insertHTML(divID, tag) {
    var e = getByID(divID);
    e.innerHTML = tag + e.innerHTML;
}

function insertHTML2(divID, tag) {
	var e = getByID(divID);
	e.innerHTML = e.innerHTML + tag;
}


function replaceHTML (divID, tag) {
  var e = getByID(divID);
	if(!e){
		return;
	}
  e.innerHTML = tag;
}

function replaceImage (theme, divs) {
    for (i in divs) {
        var imageURL = themeBaseURI + '/' + theme + '/' + theme + '-' + divs[i] + '.gif';        
        var tag = '<img src="' + imageURL + '" alt="' + divs[i] + '" />';
        replaceHTML(divs[i], tag);
    }
}

function replaceButton (theme, classes) {
    for (i in classes) {
        doReplaceLinkToImage(classes[i], theme + '/' + theme + '-' + classes[i] + '.gif', '');
    }
}

function doReplaceLinkToImage (className, imageFilename, title) {
    if (title) {
        title = 'alt="' + title + '" ';
    } else {
        title = '';
    }
    var imageURL = themeBaseURI + '/' + imageFilename;
    var tag = '<img src="' + imageURL + '" ' + title + '/>';
    doReplaceLinkInnerHTML (className, tag);
}

function doReplaceLinkInnerHTML (className, str) {
    var e = getByTagName('a');
    var len = e.length;
    for (i=0; i<len; i++) {
        if (e[i].className == className) {
            e[i].innerHTML = str;
        }
    }
}

function eraseSeparator () {
    var e = getByTagName('span');
    var len = e.length;
    for (i=0; i<len; i++) {
        if (e[i].className == 'separator') {
            e[i].innerHTML = '';
        }
    }
}

function getByID (n) {
    var d = window.document;
    if (d.getElementById)
        return d.getElementById(n);
    else if (d.all)
        return d.all[n];
}

function getByTagName (n) {
    var d = window.document;
    if (d.getElementsByTagName)
        return d.getElementsByTagName(n);
    else if (d.all)
        return d.all[n];
}
