﻿//FlashBanner 배열Data
var FlashBannerArray = new Array("healience_230_155.swf"
, "hfit_230_155.swf"
, "senior_230_155.swf"
, "urusa_230x155.swf"
)

//Array 램덤으로 재 정렬
function RandomArray(Array) {
    var i = Array.length;
    while (1 <= --i) {
        var j = Math.floor(Math.random() * (i + 1));
        var tmp = Array[j];
        Array[j] = Array[i];
        Array[i] = tmp;
    }
	//DNC배너 강제우선순위 적용
	var den = "110628_dnc_230_155.swf";
	var tmp2 = Array[0];
	Array[0] = den;
	Array[Array.length] = tmp2;
}
//플래시 Click
function FlashClick(code) {
    var url = "http://www.hidoc.co.kr/Banner/FlashBanner.aspx?id="+code+"&HostName="+location.host+"&PathName="+location.pathname+"&QueryString="+location.search;
    window.open(url, "FlashBannerClick");
}

//플래시 시작시 호출 viewCount입력
function FlashStart(code) {
    $.ajax({
        type: 'GET',
        url: 'http://www.hidoc.co.kr/banner/FlashBannerLog.ashx',
        data: { id: code, "HostName": location.host, "PathName": location.pathname, "QueryString": location.search },
        dataType: 'text'
    });
}
//플래시 종료시 호출 다음배너 연결
function FlashEnd(code) {
    doFlashBannerNext();
}

//플래시배너 InnerHtml
function doSetFlashBanner() {
    var FlashBanner = $("#FlashBanner");
    var innerHtml = "";
    innerHtml = GetFlashActivateString("http://www.hidoc.co.kr/banner/" + FlashBannerArray[0], 230, 155);
    FlashBanner.html(innerHtml);
}
//배열 밀기
function doFlashBannerNext() {
    var temp = FlashBannerArray.shift();
    FlashBannerArray.push(temp);
    doSetFlashBanner();
}


function GetFlashActivateString(strFlashUrl, width, height, img) {
    var textToWrite = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+width+"' height='"+height+"'>\n";
    textToWrite += "    <param name='movie' value='" + strFlashUrl + "' />\n";
    textToWrite += "    <param name='quality' value='high' />\n";
    textToWrite += "    <param name='wmode' value='transparent' />\n";
    textToWrite += "    <!--[if !IE]> <-->\n";
    textToWrite += "    <object type='application/x-shockwave-flash' data='" + strFlashUrl + "' width='"+width+"' height='"+height+"'>\n";
    textToWrite += "        <param name='movie' value='" + strFlashUrl + "' />\n";
    textToWrite += "        <param name='quality' value='high' />\n";
    textToWrite += "        <param name='wmode' value='transparent' />\n";
    textToWrite += "    <!--> <![endif]-->\n";
    textToWrite += "    <p><img src='"+img+"' alt='' /></p>\n";
    textToWrite += "    <!--[if !IE]> <-->\n";
    textToWrite += "    </object>\n";
    textToWrite += "    <!--> <![endif]-->\n";
    textToWrite += "</object>\n";

    return textToWrite;
}
