var url = new Array();
var comment = new Array();
var title = new Array();


// **************** 編集 var baseBgUrl = 'http://deai-no.net/js/img/';**********************

var baseBgUrl = 'http://pjpro.com/popup/img/';
var basePicUrl = 'http://pjpro.com/popup/img/pic/';
var baseDummyUrl = 'http://pjpro.com/popup/img/dummy.gif';


url[0]='http://blog.with2.net/link.php?428640';
comment[0]='<div style="margin-bottom:5px; font-weight:bold;">ぁゃ の発言：</div>こんちわっ！初めまして★ぁゃです！今からメッセで話せます...<br clear="all">';
title[0]='';

url[1]='http://blog.with2.net/link.php?428640';
comment[1]='<div style="margin-bottom:5px; font-weight:bold;">くぅ の発言：</div>お初です★今メッセ大丈夫ですか？忙しかったら後でもいいん...<br clear="all">';
title[1]='';

url[2]='http://blog.with2.net/link.php?428640';
comment[2]='<div style="margin-bottom:5px; font-weight:bold;">理香 の発言：</div>あの〜。。。誰かいますか。。。？話しかけてください。。(；_；)...<br clear="all">';
title[2]='';

url[3]='http://blog.with2.net/link.php?428640';
comment[3]='<div style="margin-bottom:5px; font-weight:bold;">かすみ の発言：</div>こんにちゎ〜<br clear="all">';
title[3]='';

url[4]='http://blog.with2.net/link.php?428640';
comment[4]='<div style="margin-bottom:5px; font-weight:bold;">★Mika★ の発言：</div>今メッセできますか？<br clear="all">';
title[4]='';

url[5]='http://blog.with2.net/link.php?428640';
comment[5]='<div style="margin-bottom:5px; font-weight:bold;">kumi の発言：</div>あ、オンラインになってる人発見ｗ<br clear="all">';
title[5]='';

url[6]='http://blog.with2.net/link.php?428640';
comment[6]='<div style="margin-bottom:5px; font-weight:bold;">я∪κα の発言：</div>どうもｗはじめましてｗ<br clear="all">';
title[6]='';

url[7]='http://blog.with2.net/link.php?428640';
comment[7]='<div style="margin-bottom:5px; font-weight:bold;">みゆき＠寒ぃ の発言：</div>こん<br clear="all">';
title[7]='';

url[8]='http://blog.with2.net/link.php?428640';
comment[8]='<div style="margin-bottom:5px; font-weight:bold;">さっちゃん の発言：</div>初めまして。ここのチャットよく来るんですか？<br clear="all">';
title[8]='';

url[9]='http://blog.with2.net/link.php?428640';
comment[9]='<div style="margin-bottom:5px; font-weight:bold;">ψ姫ψ の発言：</div>スカイプって知ってる？もしやってたら一緒にビデオチャットし...<br clear="all">';
title[9]='';

url[10]='http://blog.with2.net/link.php?428640';
comment[10]='<div style="margin-bottom:5px; font-weight:bold;">アリス の発言：</div>おはよー★今起きたょ♪笑<br clear="all">';
title[10]='';


// **************** 編集ここまで **********************


var popAdClosed = false;
var paW = 201;
var paH = 116;
var paTime = null;
var paCookie = 'panum';

// ランダム
i=Math.floor(Math.random()*url.length);

// メイン
var mainUrl=url[i];
var mainComment=comment[i];
var mailTitle=title[i];
var mainBg=baseBgUrl+i+'.gif';
var mainPic=basePicUrl+i+'.jpg';
var mainDummy=baseDummyUrl;

function loadPopAd()
{
	var popAd = document.getElementById( 'popAdAlert' );
	var pos = parseInt( popAd.style.top );
	if( pos > 0 )
	{
		popAd.style.top = ( pos - 5 ) + 'px';
		setTimeout( 'loadPopAd()', 10 );
	}
}
function closePopAd( test )
{
	if( popAdClosed == false && test == false )
	{
		window.open( mainUrl );
	}
	document.getElementById( 'popAdAlertBackground' ).style.display = 'none';
	popAdClosed = true;
	clearTimeout( paTime );
}
function positionPopAd()
{
	divBG = document.getElementById( 'popAdAlertBackground' );
	divBG.style.top = ( getScrollTop() + getWindowHeight() - paH ) + 'px';
	divBG.style.left = ( getScrollLeft() + getWindowWidth() - paW - 10 ) + 'px';
	
	paTime = setTimeout( "positionPopAd()", 10 );	
}

// fonction de positions
var is_Netscape = navigator.appName.indexOf("Netscape")!= -1;
var is_Body = document.body;
function getWindowHeight()
{
	if( typeof window.innerHeight == 'number' )
	{
		var winH = window.innerHeight;
		if( window.scrollMaxX > 0 )
		{
			winH -= 17;
		}
		return winH;
	}
	else if ( document.documentElement.clientHeight)
	{
		return document.documentElement.clientHeight;
	}
	else if( typeof document.body.clientHeight == 'number' )
	{
		return document.body.clientHeight;
	}
}
function getWindowWidth()
{
	if( typeof window.innerWidth == 'number' )
	{
		var winW = window.innerWidth;
		if( window.scrollMaxY > 0 )
		{
			winW -= 17;
		}
		return winW;
	}
	else if ( document.documentElement.clientWidth )
	{
		return document.documentElement.clientWidth;
	}
	else if( document.body && document.body.clientWidth )
	{
		return document.body.clientWidth;
	}
}
function getScrollLeft()
{
	var posLeft = false;
	
	if( is_Netscape )
	{
		posLeft = window.pageXOffset;
	}
	else if( document.documentElement && document.documentElement.scrollTop )
	{
		posLeft = document.documentElement.scrollLeft;
	}
	else if( is_Body )
	{
		posLeft = document.body.scrollLeft;
	}
	
	return typeof posLeft == 'number' ? posLeft : 0;
}
function getScrollTop()
{
	var posTop = false;
	
	if (window.innerHeight)
	{
		posTop = window.pageYOffset;
	}
	else if( document.documentElement && document.documentElement.scrollTop )
	{
		posTop = document.documentElement.scrollTop;
	}
	else if( is_Body )
	{
		posTop = document.body.scrollTop;
	}
	
	return typeof posTop == 'number' ? posTop : 0;
}

// cookies
function getCookie( name )
{
	var cookieLen = name.length;
	var cookieData = document.cookie;
	var allcookieLen = cookieData.length;
	
	var i = 0;
	var cookieEnd;
	
	while( i < allcookieLen )
	{
		var j = i + cookieLen;
		if( cookieData.substring( i, j ) == name )
		{
			cookieEnd = cookieData.indexOf( ";", j );
			if( cookieEnd == -1 )
			{
				cookieEnd = cookieData.length;
			}
			return unescape( cookieData.substring( j + 1, cookieEnd ) );
		}
		i++;
	}
	return 0;
}	
document.cookie = paCookie + '=' + ( parseInt( getCookie( paCookie ) ) + 1 );

function addOnLoadEvent( func )
{
	if( typeof window.onload != 'function' )
	{
		window.onload = func;
	}
	else
	{
		var oldOnload = window.onload;
		window.onload = function()
		{
			oldOnload();
			func();
		}
	}
}

if( getCookie( paCookie ) <= 0 || 0 == 0 )
{
	document.write('<style type="text/css">#popAdAlertBackground,#popAdAlert,#popAdTitle,#popAdGreenButton,#popAdClose,#popAdImg,#popAdDesc{margin:0px;padding:0px;font:normal 12px Arial;color:#333333;}#popAdAlertBackground,#popAdAlert{width:201px;height:116px;}#popAdAlertBackground{position:absolute;right:10px;bottom:0px;overflow:hidden;z-index:5;}#popAdAlert{cursor:pointer;position:relative;background:url( '+ mainBg + ' );}#popAdTitle{font-weight:bold;color:#333333;padding-left:23px;line-height:21px;height:21px;text-align:left;}#popAdImg{float:left;width:61px;height:62px;margin-right:5px;border:0px solid black;}#popAdClose{float:right;}#popAdDesc{padding:5px;text-align:left;}</style><div id="popAdAlertBackground" onselectstart="return false;"><div id="popAdAlert" onClick="closePopAd( false )" style="top:120px"><div id="popAdTitle"><a href="javascript:void(0)" target="_self" onClick="closePopAd( true )"><img id="popAdClose" src="'+ mainDummy + '" border="0" width="30" height="21"></a>'+ mailTitle +'</div><div id="popAdDesc"><img id="popAdImg" width="61" height="62" src="'+ mainPic +'" />'+ mainComment + '<div style="margin-top:10px; margin-bottom:0; padding-bottom:0; text-align:right; color:#0000cc; text-decoration:underline;">チャットを開始(S)</div></div></div></div>' );
	function loadPopAdNow()
	{			
		positionPopAd();
					loadPopAd();
		
	}
	addOnLoadEvent(
		function()
		{
			setTimeout( 'loadPopAdNow()', 5 * 100 );
		}
	);
}
