function d_setCookie(name, value) {
	var today = new Date();
	today.setDate( today.getDate() + 365 );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() +";";
}

function d_getCookie( name ) {
	var cookieName = name + "=";
	var x = 0;
	while ( x <= document.cookie.length ) {
		var y = (x+cookieName.length);
		if ( document.cookie.substring( x, y ) == cookieName ) {
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 ) break;
	}
	return "";
}

var wv_java = 'Unknown';
var wv_cookie = 'Unknown';
var wv_browser = 'Unknown';
var wv_browserV = 'Unknown';
var wv_ref = '';
var wv_arg= '';
var wv_url = '';
var wv_os='Unknown';



wv_java = (navigator.javaEnabled()==true)?'1':'0';
wv_cookie = (navigator.cookieEnabled==true)?'1':'0';

wv_browser=navigator.appName;
wv_cpu=navigator.cpuClass; 
wv_plat=navigator.platform;
wv_appV=navigator.appVersion;



if(wv_browser.charAt(0) == "N") {
	wv_browserV=wv_appV.substring(0,wv_appV.indexOf(" "));
	
	if(wv_browserV.charAt(0) == "3") {
		wv_browser = "br_Netscape3";
	} else if(wv_browserV.charAt(0) == "4") {
		wv_browser = "br_Netscape4";
	} else if(wv_browserV.charAt(0) == "5") {
		wv_browser = "br_Netscape5";
	} else if(wv_browserV.charAt(0) == "6") {
		wv_browser = "br_Netscape6";
	} else {
		wv_browser = "br_Unknown";
	}

} else if(wv_browser.charAt(0) == "M") {
	wv_browserV=wv_appV.substring(wv_appV.indexOf("MSIE")+5, wv_appV.indexOf("MSIE")+8);

	if(wv_browserV.charAt(0) == "4") {
		wv_browser = "br_InternetExplorer4";
	} else if(wv_browserV.charAt(0) == "5") {
		wv_browser = "br_InternetExplorer5";
	} else if(wv_browserV.charAt(0) == "6") {
		wv_browser = "br_InternetExplorer6";
	} else if(wv_browserV.charAt(0) == "7") {
		wv_browser = "br_InternetExplorer7";
	} else if(wv_browserV.charAt(0) == "8") {
		wv_browser = "br_InternetExplorer8";
	} else {
		wv_browser = "br_Unknown";
	}

}


wv_ref=document.referrer;
wv_url=document.URL;
wv_page=document.URL;

if(wv_url.charAt(wv_url.length)=='/') wv_url=wv_url.substring(0,wv_url.length-1);
if(wv_url.indexOf('://')) wv_url=wv_url.substring(wv_url.indexOf('://')+3,wv_url.length);
if(wv_url.indexOf('/')) wv_url=wv_url.substring(0,wv_url.indexOf('/'));

if(wv_ref.charAt(wv_ref.length)=='/') wv_ref=wv_ref.substring(0,wv_ref.length-1);
if(wv_ref.indexOf('://')) wv_ref=wv_ref.substring(wv_ref.indexOf('://')+3,wv_ref.length);
if(wv_ref.indexOf('/')) wv_ref=wv_ref.substring(0,wv_ref.indexOf('/'));
if( wv_ref.indexOf(':') > 0 ) wv_ref=wv_ref.substring(0,wv_ref.indexOf(':'));

if( (wv_ref=='undefined')||( wv_ref == '' )) wv_ref = 'bookmark' ;

if(wv_page.charAt(wv_page.length-1)=='/') wv_page=wv_page.substring(0,wv_page.length-1);
if(wv_page.lastIndexOf('/')) wv_page=wv_page.substring(wv_page.lastIndexOf('/')+1,wv_page.length);
if(wv_page.indexOf('?') == 0) wv_page='index';
else if(wv_page.indexOf('?') > 1) wv_page=wv_page.substring(0,wv_page.indexOf('?'));
if( (wv_page == wv_url) || (wv_page.indexOf('.') < 0) ) wv_page='index';
if( wv_page.indexOf('#') > 0 ) wv_page=wv_page.substring(0,wv_page.indexOf('#'));
//document.write (wv_page.indexOf('?'));

/*
if (navigator.language) {
	wv_ul = navigator.language.toLowerCase();
} else if (navigator.userLanguage) {
	wv_ul = navigator.userLanguage.toLowerCase();
}
*/
if( wv_plat.indexOf('undefined') >= 0 || wv_plat ==  '' ) wv_os = 'os_Unknown' ;

else wv_os = wv_plat ;

if( wv_os.indexOf('Win32') >= 0 ){

	if( wv_appV.indexOf('98')>=0) wv_os = 'os_Windows98';
	else if( wv_appV.indexOf('95')>=0 ) wv_os = 'os_Windows95';
	else if( wv_appV.indexOf('Me')>=0 ) wv_os = 'os_WindowsMe';
	else if( wv_appV.indexOf('NT')>=0 ) wv_os = 'os_WindowsNT';
	else wv_os = 'Windows' ;

	if( wv_appV.indexOf('NT 5.0')>=0) wv_os = 'os_Windows2000';
	if( wv_appV.indexOf('NT 5.1')>=0) wv_os = 'os_WindowsXP';
	if( wv_appV.indexOf('NT 5.2')>=0) wv_os = 'os_Windows2003';
	if( wv_appV.indexOf('NT 6.0')>=0) wv_os = 'os_WindowsVista';
	

} else {

	wv_plat_substr = wv_plat.substring(0,4);

	if( wv_plat_substr == 'Wind') wv_os = 'os_Windows31';
	else if( wv_plat_substr == 'Mac6' ) wv_os = 'os_Mac' ;
	else if( wv_plat_substr == 'MacO' ) wv_os = 'os_Mac' ;
	else if( wv_plat_substr == 'MacP' ) wv_os = 'os_Mac' ;
	else if(  wv_plat_substr == 'Linu' ) wv_os = 'os_Linux' ;
//	else if(  wv_plat_substr == 'WebT' ) wv_os = 'WebTV' ;
//	else if(  wv_plat_substr =='OSF1' ) wv_os = 'Compaq Open VMS' ;
//	else if(  wv_plat_substr == 'HP-U' ) wv_os = 'HP Unix' ;
	else if(  wv_plat_substr == 'OS/2' ) wv_os = 'os_OS2' ;
//	else if( wv_plat_substr == 'AIX4' ) wv_os = 'AIX';
	else if( wv_plat_substr == 'Free' ) wv_os = 'os_FreeBSD';
//	else if( wv_plat_substr == 'SunO' ) wv_os = 'SunO';
//	else if( wv_plat_substr == 'Drea' ) wv_os = 'Drea';
//	else if( wv_plat_substr == 'Plan' ) wv_os = 'Plan';
	else wv_os = 'os_Unknown';
}
/*
if( wv_cpu == 'x86' ) wv_cpu = 'Intel x86';
else if( wv_cpu == 'PPC' ) wv_cpu = 'Power PC';
else if( wv_cpu == '68k' ) wv_cpu = 'Motorola 680x';
else if( wv_cpu == 'Alpha' ) wv_cpu = 'Compaq Alpa';
else if( wv_cpu == 'Arm' ) wv_cpu = 'ARM';
else wv_cpu = 'UNKNOWN';
*/
wv_resolution=window.screen.width+'x'+window.screen.height;
if(wv_resolution.indexOf('640x480') >= 0 ) {
	wv_resolution = 're_640x480';
} else if (wv_resolution.indexOf('800x600') >= 0 ) {
	wv_resolution = 're_800x600';
} else if (wv_resolution.indexOf('1024x600') >= 0 ) {
	wv_resolution = 're_1024x600';
} else if (wv_resolution.indexOf('1024x768') >= 0 ) {
	wv_resolution = 're_1024x768';
} else if (wv_resolution.indexOf('1152x864') >= 0 ) {
	wv_resolution = 're_1152x864';
} else if (wv_resolution.indexOf('1280x720') >= 0 ) {
	wv_resolution = 're_1280x720';
} else if (wv_resolution.indexOf('1280x768') >= 0 ) {
	wv_resolution = 're_1280x768';
} else if (wv_resolution.indexOf('1280x800') >= 0 ) {
	wv_resolution = 're_1280x800';
} else if (wv_resolution.indexOf('1280x960') >= 0 ) {
	wv_resolution = 're_1280x960';
} else if (wv_resolution.indexOf('1280x1024') >= 0 ) {
	wv_resolution = 're_1280x1024';
} else if (wv_resolution.indexOf('1366x768') >= 0 ) {
	wv_resolution = 're_1366x768';
} else if (wv_resolution.indexOf('1400x1050') >= 0 ) {
	wv_resolution = 're_1400x1050';
} else if (wv_resolution.indexOf('1440x900') >= 0 ) {
	wv_resolution = 're_1440x900';
} else if (wv_resolution.indexOf('1600x768') >= 0 ) {
	wv_resolution = 're_1600x768';
} else if (wv_resolution.indexOf('1600x900') >= 0 ) {
	wv_resolution = 're_1600x900';
} else if (wv_resolution.indexOf('1600x1024') >= 0 ) {
	wv_resolution = 're_1600x1024';
} else if (wv_resolution.indexOf('1600x1200') >= 0 ) {
	wv_resolution = 're_1600x1200';
} else if (wv_resolution.indexOf('1680x1050') >= 0 ) {
	wv_resolution = 're_1680x1050'
} else if (wv_resolution.indexOf('1920x1080') >= 0 ) {
	wv_resolution = 're_1920x1080';
} else if (wv_resolution.indexOf('1920x1200') >= 0 ) {
	wv_resolution = 're_1920x1200';
} else if (wv_resolution.indexOf('1920x1440') >= 0 ) {
	wv_resolution = 're_1920x1440';
} else if (wv_resolution.indexOf('2048x1536') >= 0 ) {
	wv_resolution = 're_2048x1536';
} else if (wv_resolution.indexOf('2560x1600') >= 0 ) {
	wv_resolution = 're_2560x1600';
} else {
	wv_resolution = 're_Unknown';
}

// wv_ColorDepth=(wv_browser.charAt(0)=="M")?screen.colorDepth:screen.pixelDepth;

var s_day = new Date();
	
//var user_time=s_day.getFullYear()+"/"+(s_day.getMonth()+1)+"/"+s_day.getDate()+" "+s_day.getHours()+":"+s_day.getMinutes();

var user_zone=s_day.getTimezoneOffset()/60;

if(user_zone == 12) {
	user_zone = 'gmt_24';
} else if(user_zone == 11) {
	user_zone = 'gmt_01';
} else if (user_zone == 10) {
	user_zone = 'gmt_02';
} else if (user_zone == 9) {
	user_zone = 'gmt_03';
} else if (user_zone == 8) {
	user_zone = 'gmt_04';
} else if (user_zone == 7) {
	user_zone = 'gmt_05';
} else if (user_zone == 6) {
	user_zone = 'gmt_06';
} else if (user_zone == 5) {
	user_zone = 'gmt_07';
} else if (user_zone == 4) {
	user_zone = 'gmt_08';
} else if (user_zone == 3) {
	user_zone = 'gmt_09';
} else if (user_zone == 2) {
	user_zone = 'gmt_10';
} else if (user_zone == 1) {
	user_zone = 'gmt_11';
} else if (user_zone == 0) {
	user_zone = 'gmt_12';
} else if (user_zone == -1) {
	user_zone = 'gmt_13';
} else if (user_zone == -2) {
	user_zone = 'gmt_14';
} else if (user_zone == -3) {
	user_zone = 'gmt_15';
} else if (user_zone == -4) {
	user_zone = 'gmt_16';
} else if (user_zone == -5) {
	user_zone = 'gmt_17';
} else if (user_zone == -6) {
	user_zone = 'gmt_18';
} else if (user_zone == -7) {
	user_zone = 'gmt_19';
} else if (user_zone == -8) {
	user_zone = 'gmt_20';
} else if (user_zone == -9) {
	user_zone = 'gmt_21';
} else if (user_zone == -10) {
	user_zone = 'gmt_22';
} else if (user_zone == -11) {
	user_zone = 'gmt_23';
} else if (user_zone == -12) {
	user_zone = 'gmt_24';
}


wv_name=wv_url.substring(0,wv_url.indexOf('/'));

var time = new Date();
var year = time.getUTCFullYear();
var month = time.getUTCMonth()+1;
var day = time.getUTCDate();
var hour = time.getUTCHours();
var min = time.getUTCMinutes();
var name = "wv_count_"+escape(wv_name);
if(month < 10) month = "0"+ month;
if(day < 10) day = "0"+ day;
if(hour < 10) hour = "0"+ hour;
if(min < 10) min = "0"+ min;
	
var old_date = d_getCookie(name);
//var old_date = 0;

d_setCookie(name,year+""+month+""+day+""+hour+""+min);


wv_arg = "<div height='0' style='top:-1;position:absolute'><img src=https://famine24.net/log/logwrite2.php?browser="+wv_browser+"&os="+wv_os;
wv_arg += "&resolution="+wv_resolution+"&java="+wv_java+"&cookie="+wv_cookie+"&ref="+escape(wv_ref)+"&url="+escape(wv_url)+"&page="+escape(wv_page);
wv_arg += "&user_zone="+user_zone+"&old_date="+old_date;
wv_arg += " border=0 height=0 width=0></div>";

document.write("<a href=http://www.worldvision.or.kr target=_blank>"+wv_arg+"</a>");
//document.write("http://log.worldvision.kr/logwrite2.php?browser="+wv_browser+"&os="+wv_os+"&resolution="+wv_resolution+"&java="+wv_java+"&cookie="+wv_cookie+"&ref="+escape(wv_ref)+"&url="+escape(wv_url)+"&page="+escape(wv_page)+"&user_zone="+user_zone+"&old_date="+old_date);
