var start_fnum = 0;
var end_fnum = 1;
var tmp_cnt=0;
var last_fnum = 0;
var galleryCloc = "";
//var ctg=(ctg && "00,10,11,12,13,14,15,16,17,90".indexOf(ctg)>-1)?ctg:"00";
function fnSettingComponent(areaName, serviceCode){
try{
var ctg= serviceCode.substring(0,2);
ctg = (ctg && "00,10,11,12,13,14,15,16,17,90".indexOf(ctg)>-1)?ctg:"00";
if(document.referrer && document.referrer.indexOf("naver.com") != -1)
{
//fn_set_cloc_link("news_slideviewer", "isplus|naver|gallery");
galleryCloc = "isplus|naver|gallery";
}else
{
if(ctg == 15){
//fn_set_cloc_link("news_slideviewer", "isplus|ent|gallery");
galleryCloc = "isplus|ent|gallery";
}
else if (ctg == 14)
{
//fn_set_cloc_link("news_slideviewer", "isplus|sports|gallery");
galleryCloc = "isplus|sport|gallery";
}
else if(ctg == 11){
//fn_set_cloc_link("news_slideviewer", "isplus|life|gallery");
galleryCloc = "isplus|life|gallery";
}
}
var $ArticleGalleryArea = $("#" + areaName);
if($ArticleGalleryArea.length > 0)
{
$ArticleGalleryArea.append("
");
$ArticleGalleryArea.show();
fnShowGalleryList();
//fnShowGalleryContent(0);
//fn_filmOn(0);
}
}
catch(e){
}
}
function fnShowGalleryList(){
//슬라이드 상단 화보리스트
$.getScript("http://static.joins.com/isplus/data/photo/inform_gallery_list.js", function(){
if(typeof(isplusgallery)!="undefined"){
var tjson = isplusgallery;
var str = "";
var str1 = "";
var str2="";
var str3 = "";
var substr_title = "";
var main_title = "";
maxCount = 7;
end_fnum = parseInt(tjson.ab_seq.length/7);
last_fnum = tjson.ab_seq.length-1;
//화보명 자르기
if(tjson.ab_title[0].value.length>15){
main_title = tjson.ab_title[0].value.substring(0,15)+"...";
}
else main_title = tjson.ab_title[0].value;
str = str + "";
str = str + "
";
str = str + "
"+main_title+"
";
str = str + "
";
str = str + "
"+main_title+"
";
str = str + "
";
str = str + "
";
str = str + "
";
str = str + "
";
str = str + "
";
str = str + "
";
str = str + "
";
str = str + "
";
str = str + "
";
//화보 썸넬 리스트
for(i=0; i<7; i++){
if(i%7==0){
str1 = str1 + " ";
}
//이미지 클래스 오버가 스크립트에서 안먹어서 여기서 분기 처리 ㅠ-ㅠ
if(i==0){
str1 = str1 + " - ";
}
else str1 = str1 + "
- ";
//상단 7장 기사썸네일 사진 이미지 120사이즈로 변경
if(tjson.art_thumb[i].value.indexOf(".tn_120.jpg")>-1)
img_url = tjson.art_thumb[i].value;
else
img_url = tjson.art_thumb[i].value+".tn_120.jpg";
img_url = img_url.replace("pds.joinsmsn.com","pds.joins.com");
str1 = str1 + "
";
str1 = str1 + " ";
if(i%7 == 6){
str1 = str1 + "
";
}
}
//드랍박스용 갤러리 리스트
for(i=0; i15){
substr_title = tjson.ab_title[i].value.substring(0,15)+"...";
}
else substr_title = tjson.ab_title[i].value;
str2 = str2 + " "+substr_title+"";
}
//화보 첫번째 기사 사진 바인딩
for(i=0; i<7; i++){
//이미지 원본 사이즈로 ..
if(tjson.art_thumb[i].value.indexOf(".tn_120.jpg")>-1)
img_url = tjson.art_thumb[i].value.replace(".tn_120.jpg","");
else
img_url = tjson.art_thumb[i].value;
img_url = img_url.replace("pds.joinsmsn.com","pds.joins.com");
// sns를 위한 링크
var strSiteLoc = encodeURIComponent(document.location);
var str_themetitle = encodeURIComponent(tjson.ab_title[i].value);
var sShareMe2day = "http://me2day.net/posts/new?new_post[body]="" + str_themetitle + "":" + strSiteLoc;// + "&new_post[tags]=" + escape("일간스포츠 화보")
var sShareTwitter = "http://twitter.com/share?text=" + str_themetitle + "&url=" + strSiteLoc;
var sShareFacebook = "http://www.facebook.com/sharer.php?u=" + strSiteLoc + "&t=" + str_themetitle;
var sShareYozm = "http://yozm.daum.net/api/popup/prePost?link="+strSiteLoc+"&prefix="+str_themetitle;
//기사 리드문 자르기
if (tjson.art_contents[i].value.length >100)
{
str_contents = tjson.art_contents[i].value.substring(0,100)+"...";
}else str_contents = tjson.art_contents[i].value;
//화보명 자르기
if(tjson.ab_title[i].value.length>20)
str_title = tjson.ab_title[i].value.substring(0,20)+"...";
else str_title = tjson.ab_title[i].value;
str3 = str3 + " ";
str3 = str3 + "
";
str3 = str3 + "
";
str3 = str3 + "
";
str3 = str3 + " ";
str3 = str3 + " "+str_contents+"";
str3 = str3 + " ";
str3 = str3 + "
";
str3 = str3 + "
";
str3 = str3 + "
";
str3 = str3 + "
";
str3 = str3 + "
";
}
$("#slide_list").html(str);
$("#divGalleryList").html(str1);
$("#ulGalleryListName").html(str2);
$("#slide_contents").html(str3);
$("#usList0").removeClass("hidden");
$("#slideviewer0").css("display","block");
}
});
}
//슬라이드에 보이는 7개까지만 화보 내용 보여주고 나머지는 슬라이드로 링크
function fnClickList(seq, gid){
//alert(seq);
if(seq != ""){
location.href = "http://isplus.live.joins.com/photo/isplusgallery/isplus_photoslide.asp?gid="+gid;
}
else
{
$("#selListName").toggleClass("over");
}
}
//좌로 삼삼 우로 삼삼
function fnMovePrevNext(type){
var tmp_last_fnum = 0;
if(type =="prev")
{
start_fnum--;
if(start_fnum <0) start_fnum = end_fnum;
// else start_fnum = tmp_cnt;
//alert(start_fnum);
$("#divGalleryList >ul").addClass("hidden");
$("#usList"+start_fnum).removeClass("hidden");
fnShowGalleryContent((start_fnum)*7);
}
else if(type=="prev_1"){
start_fnum--;
if(start_fnum <0){
start_fnum = end_fnum;
tmp_last_fnum = last_fnum;
}
else {
tmp_last_fnum = (start_fnum+1)*7 -1;
}
$("#divGalleryList >ul").addClass("hidden");
//alert(last_fnum);
$("#usList"+start_fnum).removeClass("hidden");
fnShowGalleryContent(tmp_last_fnum);
}
else if(type=="next"){
start_fnum++;
if(start_fnum > end_fnum) start_fnum = 0;
$("#divGalleryList >ul").addClass("hidden");
$("#usList"+start_fnum).removeClass("hidden");
fnShowGalleryContent((start_fnum)*7);
}
}
//상단 리스트의 해당 썸네일 on 기능
function fn_filmOn(li_num){
$("#divGalleryList>ul >li").removeClass("over");
$("#liList"+li_num).addClass("over");
}
//하단 기사사진 변경
function fnChangeContents(idx){
//alert(idx);
$("#liList"+idx).hover(function(){
$("#slide_contents > div").css("display","none");
$("#slideviewer"+idx).css("display","block");
}, function(){
});
//alert("slideviewer"+idx );
}
//슬라이드 본문 보여주기
function fnShowGalleryContent(cnt){
//alert(cnt);
var prev_num = "";
var next_num = "";
var prev_btn = "";
var next_btn = "";
$.getScript("http://static.joins.com/isplus/data/photo/inform_gallery_list.js", function(){
var str3 = "";
var tjson = isplusgallery;
if(typeof(isplusgallery)!="undefined"){
//이미지 원본 사이즈로 ..
if(tjson.art_thumb[cnt].value.indexOf(".tn_120.jpg") >0)
img_url = tjson.art_thumb[cnt].value;
else
img_url = tjson.art_thumb[cnt].value +".tn_120.jpg";
img_url = img_url.replace("pds.joinsmsn.com","pds.joins.com");
// sns를 위한 링크
var strSiteLoc = encodeURIComponent(document.location);
var str_themetitle = encodeURIComponent(tjson.ab_title[cnt].value);
var sShareMe2day = "http://me2day.net/posts/new?new_post[body]="" + str_themetitle + "":" + strSiteLoc;// + "&new_post[tags]=" + escape("일간스포츠 화보")
var sShareTwitter = "http://twitter.com/share?text=" + str_themetitle + "&url=" + strSiteLoc;
var sShareFacebook = "http://www.facebook.com/sharer.php?u=" + strSiteLoc + "&t=" + str_themetitle;
var sShareYozm = "http://yozm.daum.net/api/popup/prePost?link="+strSiteLoc+"&prefix="+str_themetitle;
/* //
prev_num = parseInt(cnt) - 1;
next_num = parseInt(cnt) + 1;
//alert(prev_num +", "+ next_num);
if(prev_num < 0){
prev_btn = "fnMovePrevNext('prev_1');";
}else{
prev_btn = "fnShowGalleryContent('"+prev_num+"');";
if((cnt != 0) && ((cnt % 7) == 0)){
prev_btn = "fnMovePrevNext('prev_1');";
}
}
if(next_num >= tjson.ab_title.length){
next_btn = "fnMovePrevNext('next')";
}else{
next_btn = "fnShowGalleryContent('"+next_num+"');";
if((next_num % 7) == 0){
next_btn = "fnMovePrevNext('next');";
}
}
//
*/
//기사 리드문 자르기
if (tjson.art_contents[cnt].value.length >100)
{
str_contents = tjson.art_contents[cnt].value.substring(0,100)+"...";
}else str_contents = tjson.art_contents[cnt].value;
//화보명 자르기
if(tjson.ab_title[cnt].value.length>20)
str_title = tjson.ab_title[cnt].value.substring(0,20)+"...";
else str_title = tjson.ab_title[cnt].value;
str3 = str3 + " ";
str3 = str3 + "
";
str3 = str3 + "
";
str3 = str3 + " ";
str3 = str3 + " "+str_contents+"";
str3 = str3 + " ";
str3 = str3 + "
";
str3 = str3 + "
";
str3 = str3 + "
";
str3 = str3 + " ";
}
//$("#slide_contents").html(str3);
/*//마우스오버때 콘텐츠 전환이 잘 안되서 다시 한번..
$("#liList"+cnt).mouseover(function(){
// $("#slide_contents").html(str3);
$("#gallery_name").text(tjson.ab_title[cnt].value);
});
//fn_filmOn(cnt);
//tmp_cnt = cnt;
*/
});
}
//슬라이드로 이동 ~~
function fnGoSlide(slidenum){
location.href = "http://isplus.live.joins.com/photo/isplusgallery/isplus_photoslide.asp?gid="+slidenum+"&cloc="+galleryCloc;
}