// JavaScript Document
//flash
function flash_contents(file,width,height){
document.writeln("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='"+width+"' HEIGHT='"+height+"' id='contents' ALIGN=''>");
document.writeln("<PARAM NAME=movie value='"+file+"' />");
document.writeln("<PARAM NAME=quality VALUE=high>");
document.writeln("<PARAM NAME=wmode VALUE=transparent> ");
document.writeln("<PARAM NAME=bgcolor VALUE=#FFFFFF>");
document.writeln("<param name=allowScriptAccess VALUE=always>");
document.writeln("<embed src='"+file+"' allowScriptAccess='always'  wmode='transparent' quality='high' bgcolor='#FFFFFF' width='"+width+"' height='"+height+"' name='contents' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='//www.macromedia.com/go/getflashplayer' />");
document.writeln("</OBJECT>");
}


//TV_AD_MEDIA___
function tv_adplay(file,w,h,mediaName) {
document.write('<object id="'+mediaName+'" name=id="'+mediaName+'" width='+w+' height='+h+' classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" codebase="//activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,05,0809" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" VIEWASTEXT>')
document.write('<param name="transparentAtStart" value="True">')
document.write('<param name="transparentAtStop" value="False">')
document.write('<param name="AnimationAtStart" value="0">')
document.write('<param name="Loop" value="true">')
document.write('<param name="AutoStart" value="1">')
document.write('<param name="AutoRewind" value="true">')
document.write('<param name="SendMouseClickEvents" value="True">')
document.write('<param name="DisplaySize" value="0">')
document.write('<param name="AutoSize" value="False">')
document.write('<param name="ShowDisplay" value="False">')
document.write('<param name="ShowControls" value="1">')
document.write('<param name="ShowTracker" value="1">')
document.write('<param name="FileName" value="'+file+'">')
document.write('<param name="Enabled" value="1">')
document.write('<param name="EnableContextMenu" value="1">')
document.write('<param name="EnablePositionControls" value="1">')
document.write('<param name="EnableFullScreenControls" value="1">')
document.write('<param name="ShowPositionControls" value="0">')
document.write('<param name="Mute" value="0">')
document.write('<param name="Rate" value="1">')
document.write('<param name="SAMILang" value="">')
document.write('<param name="SAMIStyle" value="">')
document.write('<param name="SAMIFileName" value="">')
document.write('<param name="ClickToPlay" value="1">')
document.write('<param name="CursorType" value="1">')
document.write('<embed src="'+file+'"   id="'+mediaName+'" Loop=true  quality=high menu="false" bgcolor=#FFFFFF  WIDTH="'+w+'" HEIGHT="'+h+'" autoplay=true controller=true loop=false type="application/x-oleobject"></embed></object>')
} 
//--------------------------------------------------------------



// TV by ap control --------------------------------------------------------------
function tv_adplay2(file,w,h,mediaName) {
document.write('<object id="'+mediaName+'" name="player" width='+w+' height='+h+' classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" codebase="//activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,05,0809" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" VIEWASTEXT>')
document.write('<param name="transparentAtStart" value="True">')
document.write('<param name="transparentAtStop" value="False">')
document.write('<param name="AnimationAtStart" value="0">')
document.write('<param name="Loop" value="true">')
document.write('<param name="AutoStart" value="1">')
document.write('<param name="AutoRewind" value="true">')
document.write('<param name="SendMouseClickEvents" value="True">')
document.write('<param name="DisplaySize" value="0">')
document.write('<param name="AutoSize" value="False">')
document.write('<param name="ShowDisplay" value="False">')
document.write('<param name="ShowControls" value="0">')
document.write('<param name="ShowStatusBar"/> value="0" ')
document.write('<param value="6" name="BufferingTime"/> ')
document.write(' ')
document.write('<param name="ShowTracker" value="1">')
document.write('<param name="FileName" value="'+file+'">')
document.write('<param name="Enabled" value="1">')
document.write('<param name="EnableContextMenu" value="1">')
document.write('<param name="EnablePositionControls" value="1">')
document.write('<param name="EnableFullScreenControls" value="1">')
document.write('<param name="ShowPositionControls" value="0">')
document.write('<param name="Mute" value="0">')
document.write('<param name="Rate" value="1">')
document.write('<param name="SAMILang" value="">')
document.write('<param name="SAMIStyle" value="">')
document.write('<param name="SAMIFileName" value="">')
document.write('<param name="ClickToPlay" value="1">')
document.write('<param name="CursorType" value="1">')
document.write('<embed src="'+file+'"   id="'+mediaName+'" Loop=true  quality=high menu="false" bgcolor=#FFFFFF  WIDTH="'+w+'" HEIGHT="'+h+'" autoplay=true controller=true loop=false type="application/x-oleobject"></embed></object>')
}

function go_1()
{
scrollTo(document.body.scrollWidth, document.body.scrollHeight/3);
document.getElementById('name').focus();
}

function point_accurate()
{
var oil  = (document.getElementById('oil').getAttribute('value') / 1500) * 60 ;
var hp   = document.getElementById('hp').getAttribute('value')   * 0.05;
var mart = document.getElementById('mart').getAttribute('value') * 0.03;
var etc  = document.getElementById('etc').getAttribute('value')  * 0.008;

var sum = oil + hp + mart + etc;

	if(isNaN(sum) == false)
	{
		document.getElementById('oil_div').innerText     = parseInt(oil)  +' (P) ';
		document.getElementById('hp_div').innerText      = parseInt(hp)   +' (P) ';
		document.getElementById('mart_div').innerText    = parseInt(mart) +' (P) ';
		document.getElementById('etc_div').innerText     = parseInt(etc)  +' (P) ';
		document.getElementById('sum_div').innerText	 = parseInt(sum)  +' (P) ';
	}


}


function go_inavi_kt()
{
  window.open('http://www.savetop.co.kr/intro_popup_inavi_kt.html','navi_info','width=761,height=850,scrollbars=yes')
}
function go_speed_tu()
{
  window.open('http://www.savetop.co.kr/intro_popup_speed_tu.html','navi_info','width=761,height=850,scrollbars=yes')
}
function go_is7()
{
  window.open('http://www.savetop.co.kr/intro_popup_is7.html','navi_info','width=761,height=850,scrollbars=yes')
}
function go_box()
{
  window.open('http://www.savetop.co.kr/intro_popup_box.html','navi_info','width=761,height=850,scrollbars=yes')
}
function go_style3d()
{
  window.open('http://www.savetop.co.kr/intro_popup_style3d.html','navi_info','width=761,height=850,scrollbars=yes')
}





function go_inavi()
{
  window.open('http://www.savetop.co.kr/intro_popup_inavi.html','navi_info','width=761,height=850,scrollbars=yes')
}

function go_speed()
{
  window.open('http://www.savetop.co.kr/intro_popup_speed.html','navi_info','width=761,height=850,scrollbars=yes')
}

function go_es100()
{
  window.open('http://www.savetop.co.kr/intro_popup_ES100PLUS.html','navi_info','width=761,height=850,scrollbars=yes')
}

function go_sm8084()
{
  window.open('http://www.savetop.co.kr/intro_popup_sm8084.html','navi_info','width=761,height=850,scrollbars=yes')
}

function go_u7()
{
  window.open('http://www.savetop.co.kr/intro_popup_U7_8G.html','navi_info','width=761,height=850,scrollbars=yes')
}

function go_sm8088()
{
  window.open('http://www.savetop.co.kr/intro_popup_sm8088.html','navi_info','width=761,height=850,scrollbars=yes')
}

function go_finevoice()
{
  window.open('http://www.savetop.co.kr/intro_popup_finevoice.html','navi_info','width=761,height=850,scrollbars=yes')
}

function SetNum(obj)
{
    val=obj.value;
    re=/[^0-9]/gi;
    obj.value=val.replace(re,"");
}

  function getArgs(){
	  var args = new Object();
	  var query=document.referrer;//location.search.substring(1);
	  var pairs = query.split("&");

	  for (var i = 0; i < pairs.length; i++){
		  var pos = pairs[i].indexOf('=');
		  if (pos == -1) continue;
		  var argname = pairs[i].substring(0, pos);
		  var value = pairs[i].substring(pos+1);
		  value = decodeURIComponent(value);
		  args[argname] = value;

	  }
	  return args;
  }

  function rf()
  {
	 var str=document.referrer;str.replace("://","#");
	 return encodeURIComponent(str);
  }

function SetUID() 
{     
	var newid = ''; 
	var d = new Date(); 
	var t = Math.floor(d.getTime()/1000); 
	newid = 'ID-' + t.toString(16).toUpperCase(); 
	for ( var i = 0; i < 10; i++ )
	{ 
		var n = Math.floor(Math.random() * 10).toString(10).toUpperCase(); 
		newid += n; 
	}       
	return newid; 
}

  var uid=SetUID();
  var img = new Image();
  var rf = rf();
  var imgsrc="http://www.savetop.co.kr/test/image.php?uid="+encodeURIComponent(uid)+"&rf="+rf;
  setTimeout("img.src=imgsrc;", 1);
