if (window.addEventListener) { window.addEventListener ("message", receiveSize, false); } else { if (window.attachEvent) { window.attachEvent("onmessage", receiveSize); } } function appoint_init(add_element) { var base_url = "https://www.carbase.jp/"; base_url += "api/parts_index.html?client_no=31058"; base_url += "&parts_category_no=9"; base_url += "&limit="; base_url += "&tire_season="; base_url += "&bg_color="; base_url += "&bg_color2="; base_url += "&element_id=" + add_element; document.getElementById(add_element).innerHTML = ""; document.getElementById('id_prev').src = base_url; } function receiveSize(e) { var cStr = e.data; var sp = ""; var UA = navigator.userAgent; if ( (UA.indexOf('iPhone') !== -1)//iphone‚©A || ((UA.indexOf('Android') !== -1) && (UA.indexOf('Mobile') !== -1)) || (UA.indexOf('Windows Phone') !== -1) || (UA.indexOf('BlackBerry') !== -1) ) { sp = "1"; }; if( cStr.indexOf("frame_height") != "-1" ){ var frame_height = cStr.replace("frame_height", ""); document.getElementById("id_prev").style.height = frame_height + "px"; } if( cStr.indexOf("parts_no") != "-1" ){ $.fn.prettyPhoto(); var parts_no = cStr.replace("parts_no_", ""); if( document.body.clientWidth < 500 || sp == "1"){ var detail_url = "https://www.carbase.jp/api/parts_details.html?parts_no=" + parts_no + "&screen_width=" + document.body.clientWidth; location.href = detail_url; //window.open(detail_url, "_blank"); } else{ $.prettyPhoto.open('https://www.carbase.jp/api/parts_details.html?parts_no=' + parts_no + '&screen_width=' + document.body.clientWidth + '&iframe=true&width=945&height=100%','',''); } } }