﻿// JScript File
function PopupWindow1(url, name, width, height, top, left) 
{
    left = parseInt((getWidthHeight().width - width) / 2);
    var properties = 'location=yes,width='+width+',height='+height+',top='+top+',left='+left+
    'toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=yes,resizable=yes';
    popupWin = window.open(url, name, properties); 
    popupWin.focus();
}

function checkLoad()
{
    if(document.getElementById("ctl00_ContentPlaceHolder1_TextBox1").onLoad)
    {
        document.getElementById("ctl00_ContentPlaceHolder1_TextBox1").focus();
    }
    else 
    {
        setTimeout('checkLoad();', 1000);
    }
}

function getWidthHeight() 
{
    var w = 0;
    var h = 0;
    if (typeof(window.innerWidth) == 'number') 
    {
    //Non-IE
        w = window.innerWidth;
        h = window.innerHeight;
    }
    else 
    if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) 
    {
    //IE 6+ in 'standards compliant mode'
        w = document.documentElement.clientWidth;
        h = document.documentElement.clientHeight;
    }
    else 
    if (document.body && (document.body.clientWidth || document.body.clientHeight )) {
        //IE 4 compatible
        w = document.body.clientWidth;
        h = document.body.clientHeight;
    }
    return {width:w,height:h};
}

function getElements()
{
    var x=document.getElementById("CoockieCount");
    var x1 = parseInt(x.innerHTML);
    x1=x1+  1;
    document.getElementById("CoockieCount").innerHTML=x1;
}

function Set_Cookie( name, value, expires, path, domain, secure ) 
{
    var prevdata = Get_Cookie(name);
    var setval = '';
    if(prevdata == "null")
    {
        setval = value;
    }
    else    
    {   
        setval =prevdata+ "|"+ value;
    }
    var today = new Date();
    today.setTime( today.getTime() );
    if ( expires )
    {
        expires = expires * 1000 * 60 * 60 * 24;
    }
    var expires_date = new Date( today.getTime() + (expires) );
    if(prevdata.indexOf(value)==-1)
    {
    document.cookie = name + "=" +setval +
    ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
    ( ( path ) ? ";path=" + path : "" ) + 
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ( ( secure ) ? ";secure" : "" );
    getElements();
    }
}

function Delete_Cookie( name, path, domain, location)
 {
    if ( Get_Cookie( name ) ) document.cookie = name + "=" +
    ( ( path ) ? ";path=" + path : "") +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
    GotoMainLocationLocation1();
}

function Delete_Cookie_firm( name, path, domain)
{
    if ( Get_Cookie( name ) ) document.cookie = name + "=" +
    ( ( path ) ? ";path=" + path : "") +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
    window.location="http://irbp.com.ua/shortcatalogview.aspx";
}


function Get_Cookie( name ) 
{
    var start = document.cookie.indexOf( name + "=" );
    var len = start + name.length + 1;
    if ( ( !start ) &&
    ( name != document.cookie.substring( 0, name.length ) ) )
    {
        return "null";
    }
    if ( start == -1 ) return "null";
    var end = document.cookie.indexOf( ";", len );
    if ( end == -1 ) end = document.cookie.length;
    return unescape( document.cookie.substring( len, end ) );
}

function GotoMainLocationLocation(location)
{
    window.location="http://irbp.com.ua/"+location+"/default.aspx";
}

pic = new Image();
pic.src='http://irbp.com.ua/images/indicator_mozilla_blu.gif';

function ChangeImageTo(url, uniqueId) 
{
    document.getElementById(uniqueId).src = pic.src;
    pic1 = new Image(); 
    pic1.src = url;
    document.getElementById(uniqueId).src = pic1.src;
}
