var auth_key = '1047378';
var tgtUrl = "";
var jumpUrl = "";
var jumpWindowFlg = "";

function getCookie_TAEGET(pName) {
	pName += "=";
	myCookie = document.cookie + ";";
	stPos = myCookie.indexOf(pName);
	tgtCk = "";
	if ( stPos != (-1) ) {
		enPos = myCookie.indexOf(";",stPos);
		tgtCk = myCookie.substring( (stPos + pName.length),enPos );
	}
	return tgtCk;
}
function setCookie_TAEGET(pName) {
	ranval = Math.random();
	tgtCK = pName + "=" + ranval + ";path=/";
	document.cookie = tgtCK;
}
function setCookie_TAEGETVal(pName,pVal) {
	tgtCK = pName + "=" + pVal + ";path=/";
	document.cookie = tgtCK;
}
function checkCookie_TAEGET(pName) {
	//alert(getCookie_TAEGET(pName));
	retVal = 0;
	ckVal = getCookie_TAEGET(pName)
	if ( ckVal == "" ) {
		retVal = 1;
	} else {
		retVal = parseInt(ckVal) + 1;
	}
	setCookie_TAEGETVal(pName,retVal);
	return(retVal);
}
function getReferrer_TAEGET() {
	if (document.referrer == parent.frames.location) { 
		if (parent.document.referrer == parent.parent.frames.location) { 
			return(parent.parent.document.referrer); 
		} else {
			return(parent.document.referrer); 
		}
	} else { 
		return(document.referrer); 
	} 
}
function getHostName_TAEGET() {
	ret = location.hostname;
	return(ret); 
}
function setlpg_TAEGET() {
	ranval = Math.random();
	algPath = "http://www.e-target.jp/sys/access/get_log.php"
	tgtUrl = algPath+"?a="+ auth_key +"&hide="+ranval+"&reff="+escape(getReferrer_TAEGET());

	var div = document.getElementById('ajax_dammy');
    	var out = document.createElement('script');
        out.src=tgtUrl;
    div.appendChild(out);
}
setlpg_TAEGET();

function setImg_TAEGET(img_path, link_url, link_window, b_width , b_height)
{
	try {
		var img_div = document.getElementById('ucms_img_div');
		if (img_path != "")
		{
			var txt = "";
			if (img_path.indexOf(".swf") == -1) {
				txt = '<img src="' + img_path + '" border="0" class="ucms_img" width="' + b_width + '" height="' + b_height + '" />';
			}
			else {
				txt = get_swf_Write(img_path, '', b_width, b_height);
			}
			if (link_url != "")
			{
				if (img_path.indexOf(".swf") != -1) {
					jumpUrl = link_url;
					if (link_window == "1") {
						jumpWindowFlg = true;
					}
					else {
						jumpWindowFlg = false;
					}
				}
				else {
					var temp = '<a href="' + link_url + '" ';
					if (link_window == "1") {
						temp += 'target="_blank"';
					}
					temp += '>';
					txt = temp + txt + '</a>';
				}
			}
			if (img_path.indexOf(".swf") != -1) {
				txt = '<div>' + txt + "</div>";
			}
			img_div.innerHTML = txt;
		}
	}
	catch(e)
	{
	
	}
}
function get_swf_Write(swf, bg, w, h, name, cid, cbase, wmode) {
    if (bg == undefined || bg == "") {
        bg = "#FFFFFF";
    }
    if (w == undefined || w == "") {
        w = "400";
    }
    if (h == undefined || h == "") {
        h = "250";
    }
    if (name == undefined || name == "") {
        name = "TARGET_SWF";
    }
    if (cid == undefined || cid == "") {
        cid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
    }
    if (cbase == undefined || cbase == "") {
        cbase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0";
    }
    if (wmode != "no") {
        wmode = "transparent";
    } else {
        wmode = "no";
    }
    var Str = "";
    Str += "<OBJECT classid=\"" + cid + "\" ";
    Str += "codebase=\"" + cbase + "\" ";
    Str += "WIDTH=\"" + w + "\" ";
    Str += "HEIGHT=\"" + h + "\" ";
    Str += "id=\"" + name + "\" ";
    Str += "ALIGN=\"\">";
    Str += "<PARAM NAME=\"allowScriptAccess\" VALUE=\"always\">";
    Str += "<PARAM NAME=movie VALUE=\"" + swf + "\">";
    Str += "<PARAM NAME=quality VALUE=high>";
    Str += "<PARAM NAME=bgcolor VALUE=" + bg + ">";
    if (wmode == "transparent") {
        Str += "<PARAM NAME=wmode VALUE=transparent>";
    }
    Str += "<EMBED src=\"" + swf + "\" ";
    Str += "quality=high ";
    Str += "bgcolor=" + bg + " ";
    if (wmode == "transparent") {
        Str += "wmode=transparent ";
    }
    Str += "WIDTH=\"" + w + "\" ";
    Str += "HEIGHT=\"" + h + "\" ";
    Str += "NAME=\"" + name + "\" ";
    Str += "ALIGN=\"\" ";
    Str += "swLiveConnect=\"true\" ";
    Str += "allowScriptAccess=\"always\" ";
    Str += "TYPE=\"application/x-shockwave-flash\" ";
    Str += "PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\">";
    Str += "</EMBED>";
    Str += "</OBJECT>";
    return Str;
}
function jump_TARGET()
{
	if (jumpWindowFlg) {
		window.open(jumpUrl, null);
	}
	else {
		location.href = jumpUrl;
	}
}
