﻿
var Timer;


/*end of subsite subcategorygood*/
/*scroller*/
var ScrollTimer = null;


function right() {

    //var scrollableHSpace =
    // alert(document.getElementById("divContent_1").offsetWidth - document.getElementById("divContainer_1").offsetWidth);
    // alert(document.getElementById("divContent_1").style.left)
    if (parseInt(document.getElementById("divContent_1").style.left) < document.getElementById("divContent_1").offsetWidth - document.getElementById("divContainer_1").offsetWidth)
        document.getElementById("divContent_1").style.left = (parseInt(document.getElementById("divContent_1").style.left) + 25) + "px";


}

function left() {


    if (parseInt(document.getElementById("divContent_1").style.left) > (-443))
        document.getElementById("divContent_1").style.left = (parseInt(document.getElementById("divContent_1").style.left) - 25) + "px";
}


function ScrollLeft() {
   // alert(document.getElementById('kamaTV_Slider').scrollLeft);
    //Timer = setInterval("document.getElementById('kamaTV_Slider2').scrollLeft -= 1", 90005); Timer = setInterval("document.getElementById('kamaTV_Slider').scrollLeft -= 1", 90005); 
}
function ScrollRight() {
   // alert(document.getElementById('kamaTV_Slider').scrollLeft);
    //Timer = setInterval("document.getElementById('kamaTV_Slider2').scrollLeft += 1", 90005); Timer = setInterval("document.getElementById('kamaTV_Slider').scrollLeft += 1", 90005); 
}





function menuOver(obj) {

    obj.oldClass = obj.className;


    if (obj.className.indexOf('selected') < 0) {
        obj.className = obj.className + " selected";
    }
}

function menuOut(obj) {

    obj.className = obj.oldClass;
}
function ScrollLeft() { Timer = setInterval("document.getElementById('kamaTV_Slider').scrollLeft -= 5", 10); }
function ScrollRight() { Timer = setInterval("document.getElementById('kamaTV_Slider').scrollLeft += 5", 10); }
function ScrollLeft2() { Timer = setInterval("document.getElementById('kamaTV_Slider2').scrollLeft -= 5", 10); }
function ScrollRight2() { Timer = setInterval("document.getElementById('kamaTV_Slider2').scrollLeft += 5", 10); }

/*endofscroller*/
/*homepagetabs*/


function Yetii(c, d) {
    this.active = (d) ? d : 1,
   this.timeout = null,
   this.tabclass = 'tab',
   this.activeclass = 'active',
    this.getTabs = function() {
        var a = [];
        var b = document.getElementById(c).getElementsByTagName('*');
        for (var i = 0; i < b.length; i++) {
            if ((new RegExp('\\b' + this.tabclass + '\\b')).test(b[i].className)) a.push(b[i])
        }
        return a
    }, this.links = document.getElementById(c + '-nav').getElementsByTagName('a'),
      this.tabs = this.getTabs();
    this.show = function(a) {
        for (var i = 0; i < this.tabs.length; i++) {
            this.tabs[i].style.display = ((i + 1) == a) ? 'block' : 'none';
            this.links[i].className = ((i + 1) == a) ? this.activeclass : ''
        }
    }
        , this.rotate = function(a) {
            this.show(this.active); this.active++;
            if (this.active > this.tabs.length)
                this.active = 1;
            var b = this;
            this.timeout = setTimeout(function() {
                b.rotate(a)
            }, a * 1000)
        }, this.init = function(a) {
            this.show(this.active); var b = this;
            for (var i = 0; i < this.links.length; i++) {
                this.links[i].customindex = i + 1; this.links[i].onclick = function() {
                    if (b.timeout) clearTimeout(b.timeout);
                    b.show(this.customindex); return false
                }
            } if (a) this.rotate(a)
        }
};
/*homepagetabs*/

/*float banner*/
//setTimeout(doSlide, 60000);
//setTimeout(doshow, 6000);
function doshow() {
    id = document.getElementById("hp_bottom_strip");
    timeToSlide = 50; // in milliseconds
    obj = document.getElementById("hp_bottom_strip");
    if (obj.style.display == "none") { // if it's allready hidden we slide it down  
        obj.style.visibility = "visible";
        obj.style.display = "block";
        height = obj.offsetHeight;
        obj.style.height = "0px";
        obj.style.visibility = "visible";
        slideDown(obj, 0, height, Math.ceil(height / timeToSlide));
    }
}
function doSlide() {
    id = document.getElementById("hp_bottom_strip");
    timeToSlide = 50; // in milliseconds
    obj = document.getElementById("hp_bottom_strip");
    if (obj.style.display == "none") { // if it's allready hidden we slide it down  
        obj.style.visibility = "hidden";
        obj.style.display = "block";
        height = obj.offsetHeight;
        obj.style.height = "0px";
        obj.style.visibility = "visible";
        slideDown(obj, 0, height, Math.ceil(height / timeToSlide));
    } else {
        slideUp(obj, Math.ceil(obj.offsetHeight / timeToSlide), obj.offsetHeight);
    }
}
function slideDown(obj, offset, full, px) {
    if (offset < full) {
        obj.style.height = offset + "px";
        offset = offset + px;
        setTimeout((function() { slideDown(obj, offset, full, px); }), 1);
    } else {
        obj.style.height = full + "px";
        obj.style.visibility = "visible";
        obj.style.display = "block";

    }
}
function slideUp(obj, px, full) {
    if ((obj.offsetHeight - px) > 0) {
        obj.style.height = obj.offsetHeight - px + "px";
        setTimeout((function() { slideUp(obj, px, full); }), 1);

    } else {
        obj.style.height = full + "px"; // we reset the height if we were to slide it back down  
        obj.style.display = 'none';
    }
}

/*float banner*/
/*float banner 2*/

var slideElement = null;

function slideExample4(elementId, headerElement) {

    slideElement = document.getElementById(elementId);
    //    var j = slideElement.style.width;
    //    var c =  parseInt(slideElement.style.width) * 16;
    //    var d = c / 100;
    //    var a=((slideElement.style.width * 16) / 100)
    //    slideElement.style.width = a;
    if (slideElement.up == null || slideElement.down) {
        slideUpStep1();
        slideElement.up = true;
        slideElement.down = false;
        headerElement.innerHTML = '<<';
    }
    else {
        slideDownStep1();
        slideElement.down = true;
        slideElement.up = false;
        headerElement.innerHTML = '>>';
    }
}

function slideUpStep1() {
    animate(slideElement.id, document.body.offsetWidth, 0, 20, 70, 250, slideUpStep2);
}

function slideUpStep2() {
    animate(slideElement.id, document.body.offsetWidth, 0, 20, 20, 250, null);
}

function slideDownStep1() {
    animate(slideElement.id, document.body.offsetWidth, 0, 20, 70, 250, slideDownStep2);
}

function slideDownStep2() {
    animate(slideElement.id, 0, 0, document.body.offsetWidth, 70, 250, null);
}

function animate(elementID, newLeft, newTop, newWidth, newHeight, time, callback) {
    var el = document.getElementById(elementID);
    if (el == null)
        return;

    var cLeft = parseInt(el.style.left);
    var cTop = parseInt(el.style.top);
    var a = parseInt(el.style.width);
    var cWidth;
    if (parseInt(el.style.width) == 100)
        cWidth = document.body.offsetWidth;
    else
        cWidth = parseInt(el.style.width);
    var cHeight = parseInt(el.style.height);

    var totalFrames = 1;
    if (time > 0)
        totalFrames = time / 40;

    var fLeft = newLeft - cLeft;
    if (fLeft != 0)
        fLeft /= totalFrames;

    var fTop = newTop - cTop;
    if (fTop != 0)
        fTop /= totalFrames;

    var fWidth = newWidth - cWidth;
    if (fWidth != 0)
        fWidth /= totalFrames;

    var fHeight = newHeight - cHeight;
    if (fHeight != 0)
        fHeight /= totalFrames;

    doFrame(elementID, cLeft, newLeft, fLeft, cTop, newTop, fTop,
      cWidth, newWidth, fWidth, cHeight, newHeight, fHeight, callback);
}

function doFrame(eID, cLeft, nLeft, fLeft, cTop, nTop, fTop,
    cWidth, nWidth, fWidth, cHeight, nHeight, fHeight, callback) {
    var el = document.getElementById(eID);
    if (el == null)
        return;

    cLeft = moveSingleVal(cLeft, nLeft, fLeft);
    cTop = moveSingleVal(cTop, nTop, fTop);
    cWidth = moveSingleVal(cWidth, nWidth, fWidth);
    cHeight = moveSingleVal(cHeight, nHeight, fHeight);

    el.style.left = Math.round(cLeft) + 'px';
    el.style.top = Math.round(cTop) + 'px';
    el.style.width = Math.round(cWidth) + 'px';
    el.style.height = Math.round(cHeight) + 'px';

    if (cLeft == nLeft && cTop == nTop && cHeight == nHeight
    && cWidth == nWidth) {
        if (callback != null)
            callback();

        return;
    }

    setTimeout('doFrame("' + eID + '",' + cLeft + ',' + nLeft + ',' + fLeft + ',' + cTop + ','
      + nTop + ',' + fTop + ',' + cWidth + ',' + nWidth + ',' + fWidth + ',' + cHeight + ','
      + nHeight + ',' + fHeight + ',' + callback + ')', 40);
}

function moveSingleVal(currentVal, finalVal, frameAmt) {
    if (frameAmt == 0 || currentVal == finalVal)
        return finalVal;

    currentVal += frameAmt;
    if ((frameAmt > 0 && currentVal >= finalVal)
      || (frameAmt < 0 && currentVal <= finalVal)) {
        return finalVal;
    }
    return currentVal;
}
/*float banner 2*/

function Yetii(c, d) { this.active
 = (d) ? d : 1, this.timeout = null, this.tabclass = 'tab', this.activeclass = 'active', this.getTabs = function() { var a = []; var b = document.getElementById(c).getElementsByTagName('*'); for (var i = 0; i < b.length; i++) { if ((new RegExp('\\b' + this.tabclass + '\\b')).test(b[i].className)) a.push(b[i]) } return a }, this.links = document.getElementById(c + '-nav').getElementsByTagName('a'), this.tabs = this.getTabs(); this.show = function(a) { for (var i = 0; i < this.tabs.length; i++) { this.tabs[i].style.display = ((i + 1) == a) ? 'block' : 'none'; this.links[i].className = ((i + 1) == a) ? this.activeclass : '' } }, this.rotate = function(a) { this.show(this.active); this.active++; if (this.active > this.tabs.length) this.active = 1; var b = this; this.timeout = setTimeout(function() { b.rotate(a) }, a * 1000) }, this.init = function(a) { this.show(this.active); var b = this; for (var i = 0; i < this.links.length; i++) { this.links[i].customindex = i + 1; this.links[i].onclick = function() { if (b.timeout) clearTimeout(b.timeout); b.show(this.customindex); return false } } if (a) this.rotate(a) } };

function Focus(InId, InTxt) {
    if (document.getElementById(InId).value == '') {

    }
    else
        document.getElementById(InId).value = '';
}
function Focus2(InId, InTxt) {
    if (document.getElementById(InId).value == '') {
        document.getElementById(InId).value = InTxt;
    }

}
/***************************************************************************************/
function changedate(pickdate, status) {
    //alert("sucssess:" + pickdate);
    var a;
    var idxdate;
    var firstspl;
    if (status == "start") {
        firstspl = pickdate.toString().substring(0, 10).split(" ");

        idxdate = firstspl[0].toString().split("/");

        a = idxdate[0] + "/" + idxdate[1] + "/" + idxdate[2];
     //   alert(window.location);
        var loc = window.location.pathname;
        var search = "article";
       var locres = loc.search(search);

       if (locres != (-1)) {

           document.getElementById("ctl00_ContentPlaceHolder1_isrealrentcar_TextBoxstartdate").innerHTML = a;
           document.getElementById("ctl00_ContentPlaceHolder1_isrealrentcar_HiddenFieldstartdate").value = a;
       }
       else {
           // var url = window.opener.location;
           // var urlparts = url.split('/');
           // var host = urlparts[0];

           var loc2 = window.location.pathname;
           var search2 = "bannerisrealrentcar";
           var locres2 = loc2.search(search2);
           if (locres2 == (-1)) {
           
               var loc3 = window.location.pathname;
               var search3 = "subcategory";
               var locres3 = loc3.search(search3);
               if (locres3 == (-1)) {
                   document.getElementById("ctl00_ContentPlaceHolder1_insurance5_TextBoxstartdate").innerHTML = a;
                   document.getElementById("ctl00_ContentPlaceHolder1_insurance5_HiddenFieldstartdate").value = a;

               }
               else {
                   
                   document.getElementById("ctl00_ContentPlaceHolder1_Isrealrent1_TextBoxstartdate").innerHTML = a;
                   document.getElementById("ctl00_ContentPlaceHolder1_Isrealrent1_HiddenFieldstartdate").value = a;
                  // var bba=document.getElementById("ctl00_ContentPlaceHolder1_Isrealrent1_HiddenFieldstartdate").value;
                   //alert(document.getElementById("ctl00_ContentPlaceHolder1_Isrealrent1_HiddenFieldstartdate").value);
               }
           }
           else {
               document.getElementById("ctl00_ContentPlaceHolder1_TextBoxstartdate").innerHTML = a;
               document.getElementById("ctl00_ContentPlaceHolder1_HiddenFieldstartdate").value = a;

           }
       }
    }
    else {

        firstspl = pickdate.toString().substring(0, 10).split(" ");


        idxdate = firstspl[0].toString().split("/");

        a = idxdate[0] + "/" + idxdate[1] + "/" + idxdate[2];

        var loc = window.location.pathname;
        var search = "article";
        var locres = loc.search(search);
    
        if (locres != (-1)) {

            document.getElementById("ctl00_ContentPlaceHolder1_isrealrentcar_TextBoxenddate").innerHTML = a;
            document.getElementById("ctl00_ContentPlaceHolder1_isrealrentcar_HiddenFieldenddate").value = a;
        }
        else {
            var loc2 = window.location.pathname;
           var search2 = "bannerisrealrentcar";
           var locres2 = loc2.search(search2);
           if (locres2 == (-1)) {
               var loc3 = window.location.pathname;
               var search3 = "subcategory";
               var locres3 = loc3.search(search3);
               if (locres3 == (-1)) {
                   document.getElementById("ctl00_ContentPlaceHolder1_insurance5_TextBoxenddate").innerHTML = a;
                   document.getElementById("ctl00_ContentPlaceHolder1_insurance5_HiddenFieldenddate").value = a;
               }
               else {
                   document.getElementById("ctl00_ContentPlaceHolder1_Isrealrent1_TextBoxenddate").innerHTML = a;
                   document.getElementById("ctl00_ContentPlaceHolder1_Isrealrent1_HiddenFieldenddate").value = a;
                }
        }
        else {
            document.getElementById("ctl00_ContentPlaceHolder1_TextBoxenddate").innerHTML = a;
            document.getElementById("ctl00_ContentPlaceHolder1_HiddenFieldenddate").value = a;

        }
        }

             
        //document.getElementById("TextBoxenddate").Text = pickdate;
    }

}
function changehomepagedate(pickdate, status) {
    //alert("sucssess:" + pickdate);
    var a;
    var idxdate;
    var firstspl;
    if (status == "start") {
        firstspl = pickdate.toString().substring(0, 10).split(" ");

        idxdate = firstspl[0].toString().split("/");

        a = idxdate[0] + "/" + idxdate[1] + "/" + idxdate[2];
        //   alert(window.location);

        document.getElementById("ctl00_ContentPlaceHolder1_isrealrent_TextBoxstartdate").innerHTML = a;
       document.getElementById("ctl00_ContentPlaceHolder1_isrealrent_HiddenFieldstartdate").value = a;
     
 
         
    }
    else {

        firstspl = pickdate.toString().substring(0, 10).split(" ");


        idxdate = firstspl[0].toString().split("/");

        a = idxdate[0] + "/" + idxdate[1] + "/" + idxdate[2];


        document.getElementById("ctl00_ContentPlaceHolder1_isrealrent_TextBoxenddate").innerHTML = a;
        document.getElementById("ctl00_ContentPlaceHolder1_isrealrent_HiddenFieldenddate").value = a;
    
  


        //document.getElementById("TextBoxenddate").Text = pickdate;
    }

}

//************************************************************//
function scrolltocomment() {
    var e = document.getElementById('commentbox');
    var offset = { x: 0, y: 0 };
    while (e) {
        offset.x += e.offsetLeft;
        offset.y += e.offsetTop;
        e = e.offsetParent;
    }

    if (document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {
        offset.x -= document.documentElement.scrollLeft;
        offset.y -= document.documentElement.scrollTop;
    }
    else if (document.body && (document.body.scrollTop || document.body.scrollLeft)) {
        offset.x -= document.body.scrollLeft;
        offset.y -= document.body.scrollTop;
    }
    else if (window.pageXOffset || window.pageYOffset) {
        offset.x -= window.pageXOffset;
        offset.y -= window.pageYOffset;
    }

    alert(offset.x + '\n' + offset.y);
}
/*********** category menu ********/
function getInternetExplorerVersion() // Returns the version of Internet Explorer or a -1 
// (indicating the use of another browser).
{
    var rv = -1; // Return value assumes failure.
    if (navigator.appName == 'Microsoft Internet Explorer') {
        var ua = navigator.userAgent;
        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(ua) != null) rv = parseFloat(RegExp.$1);
    }
    return rv;
}
function checkVersion() {
    var msg = "You're not using Internet Explorer.";
    var ver = getInternetExplorerVersion();
    if (ver > -1) {
        if (ver == 7.0)
            msg = "You're using a recent copy of Internet Explorer."
        else
            msg = "You should upgrade your copy of Internet Explorer.";
    }
    alert(msg);
}
function opendiv(lists) {

    if (lists.id == "")
        return;
    var prename = lists.id;
    var name = prename.substring(6, 8) + "_list";

    document.getElementById(name).style.display = "block";

    document.getElementById(name).style.top = document.getElementById(lists.id).offsetTop + 20;
    var obj = document.getElementById(lists.id).offsetLeft;
    var objright = document.getElementById(lists.id).offsetRight;
    var wid = document.getElementById(lists.id).style.width;
    var winlenght = window.offsetLeft;



    if (prename.substring(6, 8) == "l8") {
        var ver = getInternetExplorerVersion();

        if (ver > -1) {
            if (ver == 7.0)
                document.getElementById(name).style.left = obj + 115 + 92 + "px";
            else
                document.getElementById(name).style.left = obj - 115 + 88 + "px";
        }

        document.getElementById(name).style.top = 158 + "px";


    }
    else
        if (prename.substring(6, 8) == "l7") {

        var ver = getInternetExplorerVersion();
        if (ver > -1) {
            if (ver == 7.0)
                document.getElementById(name).style.left = obj + 115 + 92 + "px";
            else
                document.getElementById(name).style.left = obj - 115 + 88 + "px";
        }


        document.getElementById(name).style.top = 158 + "px";

    }
    else
        if (prename.substring(6, 8) == "l6") {

        var ver = getInternetExplorerVersion();
        if (ver > -1) {
            if (ver == 7.0)
                document.getElementById(name).style.left = obj + 115 + 92 + "px";
            else
                document.getElementById(name).style.left = obj - 115 + 88 + "px";
        }
        document.getElementById(name).style.top = 158 + "px";

    }
    else
        if (prename.substring(6, 8) == "l4") {

        var ver = getInternetExplorerVersion();
        if (ver > -1) {
            if (ver == 7.0)
                document.getElementById(name).style.left = obj + 115 + 92 + "px";
            else
                document.getElementById(name).style.left = obj - 115 + 88 + "px";
        }
        document.getElementById(name).style.top = 158 + "px"

    }
    else
        if (prename.substring(6, 8) == "l2") {

        var ver = getInternetExplorerVersion();
        if (ver > -1) {
            if (ver == 7.0)
                document.getElementById(name).style.left = obj + 115 + 92 + "px";
            else
                document.getElementById(name).style.left = obj - 115 + 88 + "px";
        }
        document.getElementById(name).style.top = 158 + "px";

    }
    else
        if (prename.substring(6, 8) == "l1") {

        var ver = getInternetExplorerVersion();
        if (ver > -1) {
            if (ver == 7.0)
                document.getElementById(name).style.left = obj + 115 + 92 + "px";
            else
                document.getElementById(name).style.left = obj - 115 + 88 + "px";
        }
        document.getElementById(name).style.top = 158 + "px";

    }
    else
        if (prename.substring(6, 8) == "l3") {

        var ver = getInternetExplorerVersion();
        if (ver > -1) {
            if (ver == 7.0)
                document.getElementById(name).style.left = obj + 115 + 92 + "px";
            else
                document.getElementById(name).style.left = obj - 115 + 88 + "px";
        }
        document.getElementById(name).style.top = 158 + "px";

    }
    else
        if (prename.substring(6, 8) == "l5") {

        var ver = getInternetExplorerVersion();
        if (ver > -1) {
            if (ver == 7.0)
                document.getElementById(name).style.left = obj + 115 + 92 + "px";
            else
                document.getElementById(name).style.left = obj - 115 + 88 + "px";
        }
        document.getElementById(name).style.top = 158 + "px";

    }
    else {

        var ver = getInternetExplorerVersion();
        if (ver > -1) {
            if (ver == 7.0)
                document.getElementById(name).style.left = obj + 115 + 100 + "px";
            else
                document.getElementById(name).style.left = obj - 115 + 102 + "px";
        }
        document.getElementById(name).style.top = 152 + "px";

    }

}
function CancelActions(lists) {
    if (lists.id == "")
        return;
    var prename = lists.id;
    var name = prename.substring(6, 8) + "_list";


    document.getElementById(name).style.display = "none";
}
function showarticlemenu() {
    document.getElementById("articlemenu").style.display = "block";
}
function hidearticlemenu() {
    document.getElementById("articlemenu").style.display = "none";
}
function hello() {
    alert("hello");
}

/************ end of category menu *****************/
