﻿// JScript File
function checkBrowser(){
    this.ver = navigator.appVersion;
	this.dom = document.getElementById ? 1 : 0;
	this.ie9 = (this.ver.indexOf("MSIE 9") > -1 && this.dom) ? 1 : 0;
	this.ie8 = (this.ver.indexOf("MSIE 8")>-1 && this.dom)?1:0;
	this.ie7 = (this.ver.indexOf("MSIE 7")>-1 && this.dom)?1:0;
	this.ie6 = (this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie5 = (this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4 = (document.all && !this.dom)?1:0;
	this.ns5 = (this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4 = (document.layers && !this.dom)?1:0;
	this.google =(this.ver.indexOf("Chrome")>-1 && this.dom)?1:0;
	this.bw = (this.ie9 || this.ie8 || this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns5 || this.google);
	return this
}
bw=new checkBrowser()
//alert(bw);
if(bw.ie4 || bw.ie5 || bw.ie6){
    location.href = "newbrowser.htm";
}

function placecontent(){
    var sObj = eval(document.getElementById('shell'));
    var cObj = eval(document.getElementById('allcontent'));
    var cw = ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth );
    sObj.style.width = (cw - 20) + "px";
    var cox = (cw/2 - (1000/2));
    if(cox < 0){
        cox = 0;
    }
    cObj.style.left = cox + "px";
}

function toggleform(){
    var fObj = eval(document.getElementById('formtbl').style);
    if(fObj.display == "none"){
        fObj.display = "block";
    }else{
        fObj.display = "none";
    }
}

function getcookie(strcname){
    var cstart, cend, cval;
    if(document.cookie.length > 0){
        //alert("1");
        cstart = document.cookie.indexOf(strcname + "=");
        if(cstart != -1){
            //alert("2");
            cstart = cstart + strcname.length + 1;
            cend = document.cookie.indexOf(";", cstart);
            if(cend == -1){
                cend = document.cookie.length;
            }
            cval = unescape(document.cookie.substring(cstart, cend));
            //alert("" + cval);
        }
    }
    return cval;
}

function findY(e){
    var tmpY = 0;
    if(e.pageY){
        
        tmpY = e.pageY;
        //alert("tmpY1: " + tmpY);
        
    }else if(e.clientY){
        if(document.documentElement.scrollTop){
            
            tmpY =  e.clientY + document.documentElement.scrollTop;
            //alert("tmpY2: " + tmpY);
        }else{
            
            tmpY = e.clientY + document.body.scrollTop;
            //alert("tmpY3: " + tmpY);
        }
        
    }
    
    if(tmpY <= 350){
            tmpY = 500;
    }
    //alert(tmpY);
    return tmpY;
}

function getviewpoint(){
    var ie=document.all && !window.opera;
    var domclientWidth = document.documentElement && parseInt(document.documentElement.clientWidth) || 100000;  //Preliminary doc width in non IE browsers
    var standardbody = (document.compatMode == "CSS1Compat") ? document.documentElement : document.body;  //create reference to common "body" across doctypes
    var scroll_top = (ie) ? standardbody.scrollTop : window.pageYOffset;
    var scroll_left = (ie) ? standardbody.scrollLeft : window.pageXOffset;
    var docwidth = (ie) ? standardbody.clientWidth : (/Safari/i.test(navigator.userAgent)) ? window.innerWidth : Math.min(domclientWidth, window.innerWidth - 16);
    var docheight = (ie) ? standardbody.clientHeight : window.innerHeight;
}

function rateitem(itemid, reqtype, reqvalue, utype, stype) {
    if (itemid != "" && reqtype != "") {
        var resp = $.ajax({
            url: '/system/frontcomponents/ajaxupdaters/rateitems.aspx?r=' + reqtype + '&i=' + itemid + '&v=' + reqvalue + '&u=' + utype + '&s=' + stype,
            type: "POST",
            dataType: "text",
            async: false
        }).responseText;
        if (resp != "") {
            if (!isNaN(strtxt)) {
                for (i = 0; i < 6; i++) {
                    if (i < parseInt(strtxt)) {
                        document.getElementById('rate_' + i).src = "/components/sitegraphics/common/star_yellow.png";
                    } else {
                        document.getElementById('rate_' + i).src = "/components/sitegraphics/common/star_grey.png";
                    }
                }
            }
        }
    }
}

function setrating(strelmguid, strrate) {
    if (strelmguid != "" && strrate != "") {
        var resp = $.ajax({
            url: '/components/ajax/ajaxrating.aspx?r=' + strrate + '&i=' + strelmguid,
            type: "POST",
            dataType: "text",
            async: false
        }).responseText;
        if (resp != "") {
            if (!isNaN(strtxt)) {
                for (i = 0; i < 6; i++) {
                    if (i < parseInt(strtxt)) {
                        document.getElementById('rate_' + i).src = "/components/sitegraphics/common/star_yellow.png";
                    } else {
                        document.getElementById('rate_' + i).src = "/components/sitegraphics/common/star_grey.png";
                    }
                }
            }
        }
    }
}

function refreshcaptcha(strelm) {
    var cObj = eval(document.getElementById(strelm));
    cObj.src = "/components/sitegraphics/blank.png";
    cObj.src = "/system/tools/captcha.ashx";
}

function setuserreject() {
    var wObj = $('<div id=\"wankershell\"></div>');
    wObj.attr("style", "display:block;width:" + $(window).width() + "px;height:" + ($(document).height() + 1000) + "px;");
    wObj.appendTo($('body'));
    var iObj = $('<img src=\"/Components/sitegraphics/reject.png\" alt=\"\"/>');
    iObj.attr("style", "position:absolute; top:" + (($(window).height() / 2) - 313) + "px; left:" + (($(window).width()/2) - 250) + "px;");
    iObj.appendTo(wObj);
}


