﻿//FlashBanner 배열Data
var FlashBannerArray = new Array("hfit_600_80.swf"
,"urusa_600_80.swf")

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_600_80.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");
}

/* 하이닥 230,155사이즈  */
//플래시 시작시 호출 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: 'jsonp',
		error:function(){

		},
		success:function(){

		}
    });
}
//플래시 종료시 호출 다음배너 연결
function FlashEnd(code) {
    doFlashBannerNext();
}

//플래시배너 InnerHtml
function doSetFlashBanner() {
    var FlashBanner = $("#FlashBanner");
    var innerHtml = "";
    innerHtml = GetFlashActivateString("http://www.hidoc.co.kr/banner/" + FlashBannerArray[0], 600, 80);
    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 += "    <param name='allowScriptAccess' value='always' />\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 += "    <param name='allowScriptAccess' value='always' />\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;
}
