window.onload = function(){
	equalcols('sidebar','shopmain',0);
	equalcols('leftside','rightside',0);
	equalcols('storesleftside','storesrightside',60);
	prepareLinks();
}

function equalcols(col1,col2,pad){
	var col1 = $(col1);
	var col2 = $(col2);
	if(col1 && col2){
		if(col1.offsetHeight > col2.offsetHeight){
			col2.style.height = (col1.offsetHeight - pad) + "px";
		} else {
			col1.style.height = (col2.offsetHeight - pad) + "px";
		}
	}
}

function prepareLinks(){
	var links = document.getElementsByClassName("zoom");
	for(i=0; i<links.length; i++){
		links[i].onclick = function(){
			window.open(this.href, "zoom", "status=no,scrollbars=no,width=500,height=500");
			return false;
		}
	}
	
	var links = document.getElementsByClassName("pressdetail");
	for(i=0; i<links.length; i++){
		links[i].onclick = function(){
			window.open(this.href, "pressdetail", "status=no,scrollbars=yes,resizable=yes,width=500,height=600");
			return false;
		}
	}

	var links = document.getElementsByClassName("closewindow");
	for(i=0; i<links.length; i++){
		links[i].onclick = function(){
			window.close();
		}
	}
	
	var fields = document.getElementsByClassName("zipcode");
	for(i=0; i<fields.length; i++){
		fields[i].onfocus = function(){
			if(this.value=="zipcode"){ this.value = ""; }
		}
		fields[i].onblur = function(){
			if(this.value==""){ this.value = "zipcode"; }
		}
	}

}

