function designConfig(h) {
	var def_main_height = "400";

	jQuery('#main').animate( {
		height : h
	}, 600, function(ev) {
	});
}

function menuclick(section) {
	jQuery('ul#menu li')
			.click(
					function(ev) {
						var next="main";
						var next_url = "main.html";
						var check = jQuery(this).find('img').attr("alt");
						switch (check) {
						case "top":
							next="main";
							next_url = "main.html";
							//designConfig("500");
							break;
						case "news":
							next="news";
							next_url = "news.html";
							//designConfig("820");
							break;
						case "concept":
							next="concept";
							next_url = "concept.html";
							//designConfig("600");
							break;
						/*case "catalogue":
							next="catalogue";
							next_url = "catalogue.html";
							//designConfig("600");
							break;
						case "styling":
							next="styling";
							next_url = "styling/jewelium.html";
							//designConfig("700");
							break;*/
						case "shoplist":
							next="shoplist";
							next_url = "shoplist.html";
							//designConfig("610");
							break;
						case "blog":
							next="blog";
							next_url = "blog.html";
							//designConfig("560");
							break;
						case "main":
							window.open('http://www.point.jp/jewelium/');
							break;
						default:
							//designConfig("560");
							break;
						}
						
						var str = location.href;

					    if (str.match(/_[a-z]*.php/)) {
					        var newlocation = str . replace(/_[a-z]*.php/ , '_'+next+'.php');
					        document.location = newlocation;
					    }else if(str.match(/index.php/)) {
					        var newlocation = str . replace(/index.php/ , 'index_'+next+'.php');
					        document.location = newlocation;
					    }else if(/\/$/){
					    	var newlocation = str . replace(/\/$/ , '\/index_'+next+'.php');
					        document.location = newlocation;
					    }else{
					    	document.location = 'index_'+next+'.php';
					    }

						if (jQuery('iframe#main_iframe').size() < 1) {
							jQuery('div#main').empty();
							jQuery('div#main')
									.append(
											'<iframe id="main_iframe" name="main_iframe" src="' + next_url + '" scrolling="no" frameborder="0" width="950" height="800"></iframe>');
						}

						jQuery('#main iframe').animate( {
							opacity : 0.0
						}, 400, function(ev) {
							if (check == "catalogue") {
								//document.location = "index_c.html";
							} else {
								iframe_loader("main_iframe", next_url);
							}
							jQuery('#main iframe').animate( {
								opacity : 1.0
							}, 800, function(ev) {
							});
						});
					});
}

// IFRAME LOADER(ヴァージョン違い対応）
function iframe_loader(target, url) {
	if (version_check() == "ie6" || version_check() == "ie7"
			|| version_check() == "ie8") {
		
		main_iframe.location.href = url;
		return false;
	} else {
		document.getElementById(target).src = url;
	}
}

// VERSION CHECKER
function version_check() {
	var type = "";
	if (navigator.userAgent.indexOf("Opera") != -1) {
		type = "opera";
	} else if (navigator.userAgent.indexOf("MSIE") != -1) {
		version = parseFloat(navigator.appVersion.split("MSIE")[1]);
		if (version == "6") {
			type = "ie6";
		} else if (version == "7") {
			type = "ie7";
		} else {
			type = "ie8";
		}
	} else if (navigator.userAgent.indexOf("Firefox") != -1) {
		type = "ff";
	} else if (navigator.userAgent.indexOf("Netscape") != -1) {
		type = "ns";
	} else if (navigator.userAgent.indexOf("Safari") != -1) {
		type = "sf";
	} else {
		type = "other";
	}
	return type;
}

//

function thumbChanger(a, id) {
	for ( var i = 1; i < 13; i++) {
		jQuery('li#thumb' + i).stop().animate( {
			opacity : a
		}, 300, function(ev) {
		});
	}

	jQuery('li#' + id).stop().animate( {
		opacity : 1.0
	}, 200, function(ev) {
	});
}

function bottom_win() {
	
	var banner_no=jQuery('#bottom_inside a').size();
	var banner_height=5+(Math.round(banner_no / 4 ))*65;
	
	jQuery('#bottom').animate( {
		height :banner_height,
		width :'950'
	}, 300, function(ev) {
		bottom_win_action_handler(bottom_win_flag);
	});
	
	jQuery('.banner_long').click(function(ev) {
		if (bottom_win_flag == "close") {
			h = banner_height;
			bottom_win_flag = "open";
		} else {
			h = 25;
			bottom_win_flag = "close";
		}
		jQuery('#bottom').animate( {
			height : h,
			width :'950'
		}, 300, function(ev) {
			bottom_win_action_handler(bottom_win_flag);
		});
	});
}

function bottom_win_action_handler(flag) {
	if (flag == "open") {
		jQuery('#bottom_inside').animate( {
			left : '0'
		}, { "duration": 800, "easing": "easeout" },  function(ev) {
		});
	} else {
		jQuery('#bottom_inside').animate( {
			left : '-950'
		},  { "duration": 800, "easing": "easeout" }, function(ev) {
		});
	}
}

function b1(){
    window.open('http://www.jewelium.jp/jishin.html', '', 'width=500, height=600, menubar=no, location=no, status=no, toolbar=no, scrollbars=yes');
}
function b2(){
    window.open('http://www.jewelium.jp/jishin/index.html', '', 'width=450, height=350, menubar=no, location=no, status=no, toolbar=no, scrollbars=yes');
}
function b3(){
    window.open('http://www.jewelium.jp/pop_iphone.html', '', 'width=360, height=420, menubar=no, location=no, status=no, toolbar=no, scrollbars=yes');
}
function b4(){
    window.open('http://www.jewelium.jp/pop_app.html', '', 'width=360, height=420, menubar=no, location=no, status=no, toolbar=no, scrollbars=yes');
}
function disp(url){
    window.open(url, "linkname", "width=360,height=420,menubar=no,location=no,status=no,toolbar=no,scrollbars=no");
}
function disp2(url){
    window.open(url, "linkname", "width=360,height=300,menubar=no,location=no,status=no,toolbar=no,scrollbars=no");
}


function version_check(){
    var type = "";
	if (navigator.userAgent.indexOf("Opera") != -1) { // Opera
		type = "opera";
	} else if (navigator.userAgent.indexOf("MSIE") != -1) { // MSIE
		version = parseFloat(navigator.appVersion.split("MSIE")[1]);

		if (version == "6") {
			type = "ie6";

		} else if (version == "7") {
			type = "ie7";

		}else if (version == "8") {
			type = "ie8";

		} else {
			type = "ie5";
		}
	} else if (navigator.userAgent.indexOf("Firefox") != -1) { //
		type = "ff";

	} else if (navigator.userAgent.indexOf("Netscape") != -1) { // 
		type = "ns";

	}  else {
		type = "other";

	}
	return type;
}


