/*
* 各種データの読み込み
*/
function init_load_html()
{
if (0 < $('#GMOHeader_Contents').size()) {
ajax_load_gmoheader_userdata();
}
if (0 < $('#LoadTopRecentCheck').size()) {
ajax_load_sidebar_toprecent();
}
if (0 < $('#LoadSideRecent').size()) {
ajax_load_sidebar_recent();
}
if (0 < $('#LoadSideFavorite').size()) {
ajax_load_sidebar_fav();
}
if (0 < $('#LoadPostReviewForm').size()) {
ajax_load_sidebar_fav();
}
if (typeof product_jan != 'undefined') {
ajax_check_product_status(product_jan);
}
}
function ajax_load_gmoheader_userdata()
{
var url = document.location;
if (typeof url != 'undefined') {
$.ajax({
type: 'POST',
url: '/login/ajax_header_userdata/1284152254',
data: 'ret_url=' + encodeURIComponent(url),
success: function(data){
if (data != '') {
$('#GMOHeader_Contents').html(data).show();
/* ログイン済みと同意 */
if (0 < $('#PostReviewFormPost').size()) {
$('#PostReviewFormDefault').hide();
$('#PostReviewFormPost').show();
$('#product_post_name').val(usernickname);
}
}
}
});
}
}
function ajax_load_sidebar_toprecent()
{
var url = document.location;
if (typeof url != 'undefined') {
$.ajax({
type: 'POST',
url: '/recentcheck/get_html_top/1284152254',
data: 'ret_url=' + encodeURIComponent(url),
success: function(data){
if (data != '') {
$('#LoadTopRecentCheck').html(data).show();
}
}
});
}
}
function ajax_load_sidebar_recent()
{
var url = document.location;
if (typeof url != 'undefined') {
$.ajax({
type: 'POST',
url: '/recentcheck/get_html/1284152254',
data: 'ret_url=' + encodeURIComponent(url),
success: function(data){
if (data != '') {
$('#LoadSideRecent').html(data).show();
}
}
});
}
}
function ajax_load_sidebar_fav()
{
var url = document.location;
if (typeof url != 'undefined') {
$.ajax({
type: 'POST',
url: '/fav/get_html/1284152254',
data: 'ret_url=' + encodeURIComponent(url),
success: function(data){
if (data != '') {
$('#LoadSideFavorite').html(data).show();
}
}
});
}
}
function ajax_load_product_form_post()
{
var url = document.location;
if (typeof url != 'undefined') {
$.ajax({
type: 'POST',
url: '/fav/get_html/1284152254',
data: 'ret_url=' + encodeURIComponent(url),
success: function(data){
if (data != '') {
$('#LoadSideFavorite').html(data).show();
}
}
});
}
}
function ajax_check_product_status(jan)
{
var url = document.location;
if (typeof url != 'undefined') {
$.ajax({
type: 'POST',
url: '/login/ajax_check_product_status/1284152254',
data: 'jan=' + encodeURIComponent(jan) + '&ret_url=' + encodeURIComponent(url),
dataType: 'json',
success: function(data){
if (data != '') {
/*
* ログイン済みか
*/
if (typeof data.logined != 'undefined' && data.logined == 'ok') {
$('.PopularShopPoint').show();
$('.PopularShopPoint').each(function()
{
if (typeof data.point != 'undefined' && data.point != '') {
}
//var p = number_format($('.pricedown', this).text() - data.point);
var p = $('.pricedown', this).text() - data.point;
p = number_format(p);
$('.pricedown', this).text(p);
});
}
/*
* お気に入り
*/
if (typeof data.fav != 'undefined' && data.fav == 'already') {
$('#Favorite .already').show();
$('#Favorite .yet').hide();
}
/*
* ツイッターに投稿可能か
*/
if (typeof data.tw != 'undefined' && data.tw == 'ok') {
$('#product_post_tw_enable').show();
$('#product_post_tw_disable').hide();
}
/*
* 自分の投稿を削除リンク
*/
if (typeof data.revies_ids != 'undefined' && 0 < data.revies_ids.length) {
for (var r in data.revies_ids) {
if (0 < data.revies_ids[r]) {
$('#reviewid_kuchikomi_' + data.revies_ids[r] + ' .review_del').show();
/*
* 投票機能
*/
$('#reviewid_kuchikomi_' + data.revies_ids[r] + ' .post_vote_self').show();
$('#reviewid_kuchikomi_' + data.revies_ids[r] + ' .post_vote_already').hide();
$('#reviewid_kuchikomi_' + data.revies_ids[r] + ' .post_vote_yet').hide();
}
}
}
/*
* 投票機能
*/
if (typeof data.vote != 'undefined' && data.vote == 'ok') {
$('.post_login_already').show();
$('.post_login_yet').hide();
}
/*
* 投票済みのレビューのボタン
*/
if (typeof data.votedreviews_ids != 'undefined' && 0 < data.revies_ids.length) {
for (var r in data.votedreviews_ids) {
if (0 < data.votedreviews_ids[r]) {
$('#reviewid_kuchikomi_' + data.votedreviews_ids[r] + ' .post_vote_already').show();
$('#reviewid_kuchikomi_' + data.votedreviews_ids[r] + ' .post_vote_yet').hide();
}
}
}
}
}
});
}
}
function number_format(str)
{
var num = new String(str).replace(/,/g, "");
while(num != (num = num.replace(/^(-?\d+)(\d{3})/, "$1,$2")));
return num;
}