function newWin(url, target, wW, wH, attr) {
	var toolbar = attr.charAt(0);
	var location = attr.charAt(1);
	var directories = attr.charAt(2);
	var status = attr.charAt(3);
	var menubar = attr.charAt(4);
	var resizable = attr.charAt(5);
	var scrollbars = (attr.charAt(6) == '1') ? 'yes':'0';
	var win_attr = 'toolbar='+toolbar+',location='+location+',directories='+directories+',status='+status+',menubar='+menubar+',resizable='+resizable+',scrollbars='+scrollbars+',width='+wW+',height='+wH;
	newWindow=open(url, target, win_attr);
}

function selectProduct(selectObj) {
	if(selectObj.options[selectObj.selectedIndex].value){
		top.location.href = selectObj.options[selectObj.selectedIndex].value;
	}
}

var gAlt;
function viewPhoto(path, alt) {
	gAlt = alt;
	new Ajax.Request(path+'photo.xml', {method: "get", onComplete: setPhoto });
}
function setPhoto(httpObj) {
	var setPhotoObj = document.getElementsByTagName("h1")[0];
	photoXml = httpObj.responseXML;
	photoFiles = httpObj.responseXML.getElementsByTagName("filename");
	photoNo = Math.round(Math.random() * (photoFiles.length - 1));
//	alert(photoNo);
	setPhotoObj.innerHTML = '<img src="images/' + photoFiles[photoNo].firstChild.nodeValue + '" width="570" height="180" alt="' +gAlt+ '" />';
}


function TableChng(hishakai){
			$('hishakai_1').style.display='none';
			$('hishakai_2').style.display='none';
			$('hishakai_3').style.display='none';
			$(hishakai).style.display='block';
}

// new add js 0906
new function(){

function heightLine(){

this.className="heightLine";
this.parentClassName="heightLineParent"
reg = new RegExp(this.className+"-([a-zA-Z0-9-_]+)", "i");
objCN =new Array();
var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all;
for(var i = 0; i < objAll.length; i++) {
var eltClass = objAll[i].className.split(/\s+/);
for(var j = 0; j < eltClass.length; j++) {
if(eltClass[j] == this.className) {
if(!objCN["main CN"]) objCN["main CN"] = new Array();
objCN["main CN"].push(objAll[i]);
break;
}else if(eltClass[j] == this.parentClassName){
if(!objCN["parent CN"]) objCN["parent CN"] = new Array();
objCN["parent CN"].push(objAll[i]);
break;
}else if(eltClass[j].match(reg)){
var OCN = eltClass[j].match(reg)
if(!objCN[OCN]) objCN[OCN]=new Array();
objCN[OCN].push(objAll[i]);
break;
}
}
}

//check font size
var e = document.createElement("div");
var s = document.createTextNode("S");
e.appendChild(s);
e.style.visibility="hidden"
e.style.position="absolute"
e.style.top="0"
document.body.appendChild(e);
var defHeight = e.offsetHeight;

changeBoxSize = function(){
for(var key in objCN){
if (objCN.hasOwnProperty(key)) {
//parent type
if(key == "parent CN"){
for(var i=0 ; i<objCN[key].length ; i++){
var max_height=0;
var CCN = objCN[key][i].childNodes;
for(var j=0 ; j<CCN.length ; j++){
if(CCN[j] && CCN[j].nodeType == 1){
CCN[j].style.height="auto";
max_height = max_height>CCN[j].offsetHeight?max_height:CCN[j].offsetHeight;
}
}
for(var j=0 ; j<CCN.length ; j++){
if(CCN[j].style){
var stylea = CCN[j].currentStyle || document.defaultView.getComputedStyle(CCN[j], '');
var newheight = max_height;
if(stylea.paddingTop)newheight -= stylea.paddingTop.replace("px","");
if(stylea.paddingBottom)newheight -= stylea.paddingBottom.replace("px","");
if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","");
if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px","");
CCN[j].style.height =newheight+"px";
}
}
}
}else{
var max_height=0;
for(var i=0 ; i<objCN[key].length ; i++){
objCN[key][i].style.height="auto";
max_height = max_height>objCN[key][i].offsetHeight?max_height:objCN[key][i].offsetHeight;
}
for(var i=0 ; i<objCN[key].length ; i++){
if(objCN[key][i].style){
var stylea = objCN[key][i].currentStyle || document.defaultView.getComputedStyle(objCN[key][i], '');
var newheight = max_height;
if(stylea.paddingTop)newheight-= stylea.paddingTop.replace("px","");
if(stylea.paddingBottom)newheight-= stylea.paddingBottom.replace("px","");
if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","")
if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px","");
objCN[key][i].style.height =newheight+"px";
}
}
}
}
}
}

checkBoxSize = function(){
if(defHeight != e.offsetHeight){
changeBoxSize();
defHeight= e.offsetHeight;
}
}
changeBoxSize();
setInterval(checkBoxSize,1000)
window.onresize=changeBoxSize;
}

function addEvent(elm,listener,fn){
try{
elm.addEventListener(listener,fn,false);
}catch(e){
elm.attachEvent("on"+listener,fn);
}
}
addEvent(window,"load",heightLine);
}

// new add js 0906
function insSelectMenu() {

var arg = insSelectMenu.arguments;

for(i = 1; i < arg.length; i++) {
setSelectMenu(arg[0], arg[i]);
}

}

function setSelectMenu(cat, id) {

var filename = getSelectFileName(cat, id);

new Ajax.Request(

filename, {
method: "get",

onSuccess: function(requiest) {
document.getElementById(id).innerHTML = requiest.responseText;
}
}
);
}

function getSelectFileName(cat, id) {

return "/products/" + cat + "/accessories/selectmenu/" + id + ".txt";
}


