document.getElementsByClassName = function (className) {
    var i, j, eltClass;
    var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all;
    var objCN = new Array();
    for (i = 0; i < objAll.length; i++) {
        eltClass = objAll[i].className.split(/\s+/);
        for (j = 0; j < eltClass.length; j++) {
            if (eltClass[j] == className) {
                objCN.push(objAll[i]);
                break;
            }
        }
    }
    return objCN;
}

function smartRollover() {
	if(document.getElementsByClassName) {
		var images = document.getElementsByClassName("hover");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match(".gif"))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace(".gif", "_on.gif"));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.gif", ".gif"));
				}
				images[i].onclick = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.gif", ".gif"));
				}

			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}

var blogs2;
//var base_url = 'index.html';
var base_url = 'http://fashioncore-midwest.com';

function CheckWindow(urls){
	if( window.opener && !window.opener.closed ){
		window.opener.location.href = base_url+urls;
		window.opener.focus();
	} else if (win_closed(blogs2)) {
	//opener - close, target - open
		if(document.all){
			w_width = window.screen.width;
			w_height = window.screen.height;
		} else{
			w_width =  innerWidth;
			w_height = innerHeight;
		}
	blogs2 = window.open(base_url+urls,"blogs2","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,directories=yes,width="+w_width+",height="+w_height);
	blogs2.focus();
		
	} else {
	blogs2 = window.open(base_url+urls,"blogs2");
	blogs2.focus();
	} 
}

function win_closed(winVar) {
	var ua = navigator.userAgent
	if( !!winVar )
	if( ( ua.indexOf('Gecko')!=-1 || ua.indexOf('MSIE 4')!=-1 )
	&& ua.indexOf('Win')!=-1 ) 
	return winVar.closed
	else return typeof winVar.document != 'object'
	else return true
}
$(document).ready(function(){
	//for slide-next
	$('#navi-archives h4').next().hide();
	$('#navi-archives h4:first').next().show();
	$('#navi-archives h4').click(function(){
		$(this).next().slideToggle(500,function() {
			if ($(this).is(':hidden')) {
			} else { 
			}
		});
		return false;
	});	

});
