

var stAuto = window.stAuto || new Object();

stAuto.naviController = {
	
	hasChildrenList:[
		"index02"
	],
	init:function(){
		var pageName = location.href.replace(/^.+\//,"").replace(/\.[a-z]+?$/,"");
		var parentName = (pageName.indexOf("_")!=-1) ? pageName.replace(/_\w/,"") : false;
		
		/* activate menu */
		if( $(pageName) ){
			$$("#"+pageName+" a")[0].addClassName("Active");
		}
		
		/* activate parent menu */
		if(parentName && $(parentName)){
			
			$$("#"+parentName+" a")[0].addClassName("Active");
		}
		
		/* children expand */
		var i;
		var item;
		for(i=0;i<this.hasChildrenList.length;i++){
			item = this.hasChildrenList[i];
			if( item != parentName && item != pageName ){
				$$("#"+this.hasChildrenList[i]+"_children")[0].style.display = "none";
			}
		}
	}
}

stAuto.itemViewer = {
	
	viewerHTML:"itemview.html",
	
	init:function(){
		var list = $$(".itemview");
		var index = list.length;
		while(index){
			img = list[index-1];
			img.pcid = img.src.replace(/.+\//,"").replace(/\..+?$/,"");
			img.viewurl = this.viewerHTML;
			
			//url = this.viewerHTML + "?" + id;
			
			
			
			Event.observe(img,"click",function(){
					var url = this.viewurl + "?" + this.pcid;
					window.open(url,"itemview","width=340,height=400");
			});
			
			img.style.cssText = (Prototype.Browser.IE) ? "cursor:hand" : "cursor:pointer;";
			index--;	
		}
	}
	
}

Event.observe(window,"load",function(){
		stAuto.naviController.init();
		stAuto.itemViewer.init();
});

