﻿var strDomain = 'http://www.giftstoindia24x7.com/';
//var strDomain = 'http://localhost:1282/';
function sndUserCheckforcolor(theOpt){http.open("get",strDomain+"Ajax.aspx?proid="+theOpt.value+"&ajmode=color");http.onreadystatechange=handleResponse;http.send(null);}
function sndUserCheckforsize(theOpt) { http.open("get", strDomain + "Ajax.aspx?proid=" + theOpt.value + "&ajmode=size"); http.onreadystatechange = handleResponse; http.send(null); }
function SelectedItem(theOpt, theTxt) { window.location.href = strDomain + "category.aspx?cat=" + theOpt.value + "&searchterm=" + theTxt.value; }
function SetDivIndexPrice(theDiv,theOpt,theFlag){if(theDiv!=null&&theOpt!=null){var i;var CurrencyUnit=new Array();var collDivs=document.getElementsByTagName('DIV');if(collDivs!=null){theFlag.innerHTML="<img src='http://www.giftstoindia24x7.com/Pictures/"+theOpt.options[theOpt.selectedIndex].text+".jpg' width='29' height='15'>";for(i=0;i<collDivs.length;i++){if(theDiv.id==collDivs[i].id){CurrencyUnit=theOpt.value.split(",");alert(CurrencyUnit[2]);collDivs[i].innerHTML="Rs. "+collDivs[i].title+" / "+CurrencyUnit[1]+" "+(collDivs[i].title/CurrencyUnit[2]).toFixed(2);}}}}
else{alert("No price found to change.");}}
function setDivPrice(theDiv,theOpt,theFlag){if(theDiv!=null&&theOpt!=null){var xmlHttpReq=false;var self=this;if(window.XMLHttpRequest){self.xmlHttpReq=new XMLHttpRequest();}
else if(window.ActiveXObject){self.xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");}
self.xmlHttpReq.open('POST', strDomain + "ajaxCommonFunction.aspx", true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() {
    if (self.xmlHttpReq.readyState == 4) {
        theOpt.disabled = false; var GetValue = new Array(); if (self.xmlHttpReq.responseText.indexOf('~' != -1)) { GetValue = self.xmlHttpReq.responseText.split("~"); }
if(GetValue[0].toString()!=""){if(GetValue[0].toString()=="0"){alert("Error : "+GetValue[1].toString());}
else{var collDivs=document.getElementsByTagName('DIV');if(collDivs!=null){theFlag.innerHTML="<img src=\"Pictures/"+theOpt.options[theOpt.selectedIndex].text+".jpg\" width=\"29\" height=\"15\">";for(i=0;i<collDivs.length;i++){if(theDiv.id==collDivs[i].id){collDivs[i].innerHTML="Rs. "+collDivs[i].title+" / "+GetValue[1].toString()+" "+(collDivs[i].title/GetValue[2]).toFixed(2);}}}}}
else{alert("Sorry! Due to some error currency cannot be changed.");}}
else{theOpt.disabled=true;theFlag.innerHTML="<img src=\"Pictures/loading.gif\" width=\"20\" height=\"20\">";}}
self.xmlHttpReq.send("mode=1&currId="+theOpt.value);}
else{alert("Sorry! No price found to change. Cannot Change currency.");}}
function setDivPrice_ppnl(theDiv,theOpt,theFlag){if(theOpt!=null){var xmlHttpReq=false;var self=this;if(window.XMLHttpRequest){self.xmlHttpReq=new XMLHttpRequest();}
else if(window.ActiveXObject){self.xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");}
self.xmlHttpReq.open('POST', strDomain + "ajaxCommonFunction_ppnl.aspx", true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() {
    if (self.xmlHttpReq.readyState == 4) {
        theOpt.disabled = false; var GetValue = new Array(); if (self.xmlHttpReq.responseText.indexOf('~' != -1)) { GetValue = self.xmlHttpReq.responseText.split("~"); }
if(GetValue[0].toString()!=""){if(GetValue[0].toString()=="0"){alert("Error : "+GetValue[1].toString());}
else{var collDivs=document.getElementsByTagName('SPAN');if(collDivs!=null){theFlag.innerHTML="<img src=\"Pictures/"+theOpt.options[theOpt.selectedIndex].text+".jpg\" width=\"29\" height=\"15\">";for(var i=0;i<collDivs.length;i++){var att=collDivs[i].getAttribute("name");if(att=="ProductPrice"){collDivs[i].innerHTML="Rs. "+collDivs[i].title+" / "+GetValue[1].toString()+" "+(collDivs[i].title/GetValue[2]).toFixed(2);}}}}}
else{alert("Sorry! Due to some error currency cannot be changed.");}}
else{theOpt.disabled=true;theFlag.innerHTML="<img src=\"Pictures/loading.gif\" width=\"20\" height=\"20\">";}}
self.xmlHttpReq.send("mode=1&currId="+theOpt.value);}
else{alert("Sorry! No price found to change. Cannot Change currency.");}}
function addToCart(mode,ProdId,CatId,qnty){var ajaxDiv=document.getElementById("dropin");if(mode!=""&&ajaxDiv!=null){var xmlHttpReq=false;var self=this;if(window.XMLHttpRequest){self.xmlHttpReq=new XMLHttpRequest();}
else if(window.ActiveXObject){self.xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");}
self.xmlHttpReq.open('POST', strDomain + "ajaxAddToCart.aspx", true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() {
    if (self.xmlHttpReq.readyState == 4) {
        var GetValue = new Array(); if (self.xmlHttpReq.responseText.indexOf('~' != -1)) {
            GetValue = self.xmlHttpReq.responseText.split("~"); if (GetValue[0].toString() == "0") { alert('There is some error. Please try again.'); }
else if(GetValue[0].toString()=="1"){var varUrl=GetValue[1].toString();window.location='Cart.aspx';}}
else{alert("There is some error on adding to cart. Please click browser refresh button.");}
ajaxDiv.style.display="none";}
else{ajaxDiv.style.display="block";positionDivOnClick(ajaxDiv);}}
self.xmlHttpReq.send("Mode="+mode+"&ProdId="+ProdId+"&CatId="+CatId+"&qnty="+qnty);}}
function addToCartNR(obj,mode,ProdId,CatId,qnty){var ajaxDiv=document.getElementById("dropin");var objMainDiv=document.getElementById("dvCartMain");if(objMainDiv!=null&&ajaxDiv!=null){obj.disabled=true;var xmlHttpReq=false;var self=this;if(window.XMLHttpRequest){self.xmlHttpReq=new XMLHttpRequest();}
else if(window.ActiveXObject){self.xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");}
self.xmlHttpReq.open('POST', strDomain + "ajaxAddToCart.aspx", true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() {
    if (self.xmlHttpReq.readyState == 4) {
        var GetValue = new Array(); if (self.xmlHttpReq.responseText.indexOf('~' != -1)) {
            GetValue = self.xmlHttpReq.responseText.split("~"); if (GetValue[0].toString() == "0") { alert("There is some error. Please try again."); }
else if(GetValue[0].toString()=="1"){objMainDiv.innerHTML=GetValue[1].toString();}
updateAlsoBought();}
else{alert("There is some error on adding to cart. Please click browser refresh button.");}
ajaxDiv.style.display="none";obj.disabled=false;}
else{ajaxDiv.style.display="block";positionDivOnClick(ajaxDiv);obj.disabled=false;}}
self.xmlHttpReq.send("Mode="+mode+"&ProdId="+ProdId+"&CatId="+CatId+"&qnty="+qnty);}}
function fnCartAdd(Mode,intcounter,proID,catId){var spnAddtocart=document.getElementById("spnBuyBtn_"+intcounter);var spnload=document.getElementById("spnload_"+intcounter);if(spnAddtocart!=null&&spnload!=null){var xmlHttpReq=false;var self=this;if(window.XMLHttpRequest){self.xmlHttpReq=new XMLHttpRequest();}
else if(window.ActiveXObject){self.xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");}
self.xmlHttpReq.open('POST', strDomain + "ajaxAddToCart.aspx", true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() {
    if (self.xmlHttpReq.readyState == 4) {
        var GetValue = new Array(); if (self.xmlHttpReq.responseText.indexOf('~' != -1)) {
            GetValue = self.xmlHttpReq.responseText.split("~"); if (GetValue[0].toString() == "0") { alert("There is some error. Please try again."); }
            else if (GetValue[0].toString() == "1") { window.location = strDomain + "cart.aspx"; } 
        }
else{alert("There is some error on adding to cart. Please click browser refresh button.");}
spnAddtocart.style.display="block";spnload.style.display="none";}
else{spnAddtocart.style.display="none";spnload.style.display="block";}}
self.xmlHttpReq.send("ProdId="+proID+"&CatId="+catId+"&mode="+Mode+"&qnty=1");}
else{alert("Objects not found. Try again.");}}
function addToCartNew(objImgName,objAjaxName,ProdId,CatId,qnty){var oi=document.getElementById(objImgName);var od=document.getElementById(objAjaxName);if(oi!=null&&od!=null){oi.disabled=true;oi.style.display="none";od.style.display="block";var xmlHttpReq=false;var self=this;if(window.XMLHttpRequest){self.xmlHttpReq=new XMLHttpRequest();}
else if(window.ActiveXObject){self.xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");}
self.xmlHttpReq.open('POST', strDomain + "ajaxAddToCart.aspx", true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() {
    if (self.xmlHttpReq.readyState == 4) {
        od.style.display = "none"; var GetValue = new Array(); if (self.xmlHttpReq.responseText.indexOf('~' != -1)) {
            GetValue = self.xmlHttpReq.responseText.split("~"); if (GetValue[0].toString() == "0") { alert('There is some error. Please try again.'); }
            else if (GetValue[0].toString() == "1") { var varUrl = GetValue[1].toString(); window.location.href = strDomain + 'cart.aspx'; }
else{oi.disabled=false;oi.style.display="block";}}
else{alert("There is some error on adding to cart. Please click browser refresh button.");}}
else{oi.disabled=true;oi.style.display="none";od.style.display="block";}}
self.xmlHttpReq.send("Mode=1&ProdId="+ProdId+"&CatId="+CatId+"&qnty="+qnty);}}
function bomShow(Mode,siteId,objName){var objTab=document.getElementById(objName);var objMain=document.getElementById("bom");var objLoader=document.getElementById("spnloadBom");if(objMain!=null&&objTab!=null&&objLoader!=null){var xmlHttpReq=false;var self=this;if(window.XMLHttpRequest){self.xmlHttpReq=new XMLHttpRequest();}
else if(window.ActiveXObject){self.xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");}
self.xmlHttpReq.open('POST', strDomain + "ajaxBestoftheMonth.aspx", true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() {
    if (self.xmlHttpReq.readyState == 4) {
        var GetValue = new Array(); if (self.xmlHttpReq.responseText.indexOf('~' != -1)) {
            objTab.disabled = false; objLoader.style.display = "none"; objMain.style.display = "block"; GetValue = self.xmlHttpReq.responseText.split("~"); if (GetValue[0].toString() == "0") { alert("There is some error. Please try again."); }
            else if (GetValue[0].toString() == "1") { objMain.innerHTML = GetValue[1].toString(); switch (objName) { case "liWeekly": document.getElementById("liWeekly").className = "bestSelect"; document.getElementById("liFortnight").className = ""; document.getElementById("liMonth").className = ""; document.getElementById("liYesterday").className = ""; objMain.innerHTML = objMain.innerHTML + "<br class=\"clear\" /><p class=\"moreSell\"><a href=\"" + strDomain + "weekly_bestseller.aspx?pageno=1\" title=\"more weekly bestseller.\">more</a></p>"; break; case "liFortnight": document.getElementById("liWeekly").className = ""; document.getElementById("liFortnight").className = "bestSelect"; document.getElementById("liMonth").className = ""; document.getElementById("liYesterday").className = ""; objMain.innerHTML = objMain.innerHTML + "<br class=\"clear\" /><p class=\"moreSell\"><a href=\"" + strDomain + "fortnight_bestseller.aspx?pageno=1\" title=\"more fortnightly bestseller.\">more</a></p>"; break; case "liMonth": document.getElementById("liWeekly").className = ""; document.getElementById("liFortnight").className = ""; document.getElementById("liMonth").className = "bestSelect"; document.getElementById("liYesterday").className = ""; objMain.innerHTML = objMain.innerHTML + "<br class=\"clear\" /><p class=\"moreSell\"><a href=\"" + strDomain + "month_bestseller.aspx?pageno=1\" title=\"more monthly bestseller.\">more</a></p>"; break; case "liYesterday": document.getElementById("liWeekly").className = ""; document.getElementById("liFortnight").className = ""; document.getElementById("liMonth").className = ""; document.getElementById("liYesterday").className = "bestSelect"; objMain.innerHTML = objMain.innerHTML + "<br class=\"clear\" /><p class=\"moreSell\"><a href=\"" + strDomain + "yesterday_bestseller.aspx?pageno=1\" title=\"more yesterday bestseller.\">more</a></p>"; break; default: document.getElementById("liWeekly").className = "bestSelect"; document.getElementById("liFortnight").className = ""; document.getElementById("liMonth").className = ""; document.getElementById("liYesterday").className = ""; objMain.innerHTML = objMain.innerHTML + "<br class=\"clear\" /><p class=\"moreSell\"><a href=\"" + strDomain + "weekly_bestseller.aspx?pageno=1\" title=\"more weekly bestseller.\">more</a></p>"; break; } } 
}
else{alert("There is some error on adding to cart. Please click browser refresh button.");}}
else{objTab.disabled=true;objLoader.style.display="block";objMain.style.display="none";}}
self.xmlHttpReq.send("Mode="+Mode+"&siteId="+siteId);}
else{alert("Objects not found. Try again.");}}
var httpRequest=false;function makeObject(){var httpRequest;if(window.XMLHttpRequest){httpRequest=new XMLHttpRequest();}
else if(window.ActiveXObject){try{httpRequest=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){httpRequest=new ActiveXObject("Microsoft.XMLHTTP");}}
return httpRequest;}
httpRequest=makeObject();function _processRequest(){if(httpRequest==null)httpRequest=makeObject();if(httpRequest.readyState==4){if(httpRequest.status==200){var response=httpRequest.responseText;var update=new Array();if(response.indexOf('`'!=-1)){update=response.split("`");if(update[0]=="AddNL"){switch(update[1]){case"T":document.getElementById("dvNLresult").innerHTML=update[2];break;case"R":document.getElementById("dvNLresult").innerHTML=update[2];break;case"F":document.getElementById("dvNLresult").innerHTML=update[2];break;}}}}}}
function callAjaxNewsLetter(){var f=true;if(document.getElementById("txtName").value==""){document.getElementById("txtEmail").style.backgroundColor="#FFFFFF";document.getElementById("txtName").focus();document.getElementById("txtName").style.backgroundColor="#FFFFCC";f=false;}
if(document.getElementById("txtEmail").value==""&&f){document.getElementById("txtName").style.backgroundColor="#FFFFFF";document.getElementById("txtEmail").focus();document.getElementById("txtEmail").style.backgroundColor="#FFFFCC";f=false;}
if(f){if(!validateEmailNL(document.getElementById("txtEmail").value)){f=true;}
else{alert("Please provide valid email address");document.getElementById("txtEmail").focus();document.getElementById("txtEmail").style.backgroundColor="#FFFFCC";f=false;}}
if(f){if(document.getElementById("newsBox")!=null){document.getElementById("newsBox").style.display="none";}
    document.getElementById("dvNLresult").style.display = "block"; document.getElementById("txtName").style.backgroundColor = "#FFFFFF"; document.getElementById("txtEmail").style.backgroundColor = "#FFFFFF"; document.getElementById("dvNLresult").innerHTML = "<img src=\"images/ajax_loader.gif\" alt=\"wait\">"; var a = document.getElementById("txtName").value; a = encodeURIComponent(a); var b = document.getElementById("txtEmail").value; b = encodeURIComponent(b); httpRequest.open("POST", strDomain + "ajaxNewsLetter.aspx", true); httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); httpRequest.onreadystatechange = _processRequest; httpRequest.send("mode=nl&nm=" + a + "&em=" + b + "&m=" + Math.random());
} 
}
function validateEmailNL(value) {
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    if (value.match(re)) {
        return (false);
    }
    return (true);
}
function IsNumeric(e){var KeyID=(window.event)?event.keyCode:e.which;if((KeyID>=66&&KeyID<=90)||(KeyID>=97&&KeyID<=122)||(KeyID>=33&&KeyID<=47)||(KeyID>=58&&KeyID<=64)||(KeyID>=91&&KeyID<=96)||(KeyID>=123&&KeyID<=126)){return false;}
return true;}
function checkchar(e){var f=false;var iChars="!@#$%^&*()+=[];/{}|\":<>?";for(var i=0;i<document.getElementById("uc_search1_txtSearch").value.length;i++){if(iChars.indexOf(document.getElementById("uc_search1_txtSearch").value.charAt(i))!=-1){f=true;}}
return f;}
function charcheck(txtname){var f=true;var exp=String.fromCharCode(window.event.keyCode)
var address=document.getElementById("txtname");var r=new RegExp("[-_,/'().0-9a-zA-Z \r]","g");if(exp.match(r)==null){window.event.keyCode=0
return false;}
return f;}
var r={'special':/[\W]/g}
function valid(o,w){o.value=o.value.replace(r[w],'');}
function check(obj,e){var KeyID=(window.event)?e.keyCode:e.which;if((KeyID>64&&KeyID<91)||(KeyID>96&&KeyID<123)||(KeyID>47&&KeyID<58)||(KeyID==8)||(KeyID==18)||(KeyID==32)||(KeyID==27)||(KeyID==13)||(KeyID==16)||(KeyID==9)||(KeyID==18)||(KeyID==0)||(KeyID==110)||(KeyID==190)||(KeyID==45)||(KeyID==39)||(KeyID==34)||(KeyID==44)){return true;}
else{return false;}}
function ddtabcontent(tabinterfaceid) {
    this.tabinterfaceid = tabinterfaceid
    this.tabs = document.getElementById(tabinterfaceid).getElementsByTagName("a")
    this.enabletabpersistence = true
    this.hottabspositions = []
    this.currentTabIndex = 0
    this.subcontentids = []
    this.revcontentids = []
    this.selectedClassTarget = "link"
}
ddtabcontent.getCookie = function(Name) {
    var re = new RegExp(Name + "=[^;]+", "i"); if (document.cookie.match(re))
        return document.cookie.match(re)[0].split("=")[1]
    return ""
}
ddtabcontent.setCookie = function(name, value) { document.cookie = name + "=" + value + ";path=/" }
ddtabcontent.prototype = { expandit: function(tabid_or_position) {
    this.cancelautorun()
    var tabref; try {
        if (typeof tabid_or_position == "string" && document.getElementById(tabid_or_position).getAttribute("rel"))
            tabref = document.getElementById(tabid_or_position)
        else if (parseInt(tabid_or_position) != NaN && this.tabs[tabid_or_position].getAttribute("rel"))
            tabref = this.tabs[tabid_or_position]
    }
    catch (err) { alert("Invalid Tab ID or position entered!") }
    if (tabref != "")
        this.expandtab(tabref)
}, cycleit: function(dir, autorun) {
    if (dir == "next") { var currentTabIndex = (this.currentTabIndex < this.hottabspositions.length - 1) ? this.currentTabIndex + 1 : 0 }
    else if (dir == "prev") { var currentTabIndex = (this.currentTabIndex > 0) ? this.currentTabIndex - 1 : this.hottabspositions.length - 1 }
    if (typeof autorun == "undefined")
        this.cancelautorun()
    this.expandtab(this.tabs[this.hottabspositions[currentTabIndex]])
}, setpersist: function(bool) { this.enabletabpersistence = bool }, setselectedClassTarget: function(objstr) { this.selectedClassTarget = objstr || "link" }, getselectedClassTarget: function(tabref) { return (this.selectedClassTarget == ("linkparent".toLowerCase())) ? tabref.parentNode : tabref }, urlparamselect: function(tabinterfaceid) {
    var result = window.location.search.match(new RegExp(tabinterfaceid + "=(\\d+)", "i"))
    return (result == null) ? null : parseInt(RegExp.$1)
}, expandtab: function(tabref) {
    if (tabref != null) {
        var subcontentid = tabref.getAttribute("rel")
        var associatedrevids = (tabref.getAttribute("rev")) ? "," + tabref.getAttribute("rev").replace(/\s+/, "") + "," : ""
        this.expandsubcontent(subcontentid)
        this.expandrevcontent(associatedrevids)
        for (var i = 0; i < this.tabs.length; i++) { if (this.tabs[i].getAttribute("rel") != null) { this.getselectedClassTarget(this.tabs[i]).className = (this.tabs[i].getAttribute("rel") == subcontentid) ? "selected" : "" } }
        if (this.enabletabpersistence)
            ddtabcontent.setCookie(this.tabinterfaceid, tabref.tabposition)
        this.setcurrenttabindex(tabref.tabposition)
    } 
}, expandsubcontent: function(subcontentid) {
    for (var i = 0; i < this.subcontentids.length; i++) {
        var subcontent = document.getElementById(this.subcontentids[i])
        subcontent.style.display = (subcontent.id == subcontentid) ? "block" : "none"
    } 
}, expandrevcontent: function(associatedrevids) {
    var allrevids = this.revcontentids
    for (var i = 0; i < allrevids.length; i++) { document.getElementById(allrevids[i]).style.display = (associatedrevids.indexOf("," + allrevids[i] + ",") != -1) ? "block" : "none" } 
}, setcurrenttabindex: function(tabposition) {
    for (var i = 0; i < this.hottabspositions.length; i++) {
        if (tabposition == this.hottabspositions[i]) {
            this.currentTabIndex = i
            break
        } 
    } 
}, autorun: function() { this.cycleit('next', true) }, cancelautorun: function() {
    if (typeof this.autoruntimer != "undefined")
        clearInterval(this.autoruntimer)
}, init: function(automodeperiod) {
    var persistedtab = ddtabcontent.getCookie(this.tabinterfaceid)
    var selectedtab = -1
    var selectedtabfromurl = this.urlparamselect(this.tabinterfaceid)
    this.automodeperiod = automodeperiod || 0
    for (var i = 0; i < this.tabs.length; i++) {
        this.tabs[i].tabposition = i
        if (this.tabs[i].getAttribute("rel")) {
            var tabinstance = this
            this.hottabspositions[this.hottabspositions.length] = i
            this.subcontentids[this.subcontentids.length] = this.tabs[i].getAttribute("rel")
            this.tabs[i].onclick = function() {
                tabinstance.expandtab(this)
                tabinstance.cancelautorun()
                return false
            }
            if (this.tabs[i].getAttribute("rev")) { this.revcontentids = this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/)) }
            if (selectedtabfromurl == i || this.enabletabpersistence && selectedtab == -1 && parseInt(persistedtab) == i || !this.enabletabpersistence && selectedtab == -1 && this.getselectedClassTarget(this.tabs[i]).className == "selected") { selectedtab = i } 
        } 
    }
    if (selectedtab != -1)
        this.expandtab(this.tabs[selectedtab])
    else
        this.expandtab(this.tabs[this.hottabspositions[0]])
    if (parseInt(this.automodeperiod) > 500 && this.hottabspositions.length > 1) { this.autoruntimer = setInterval(function() { tabinstance.autorun() }, this.automodeperiod) } 
} 
}
function AC_AddExtension(src, ext) {
    if (src.indexOf('?') != -1)
        return src.replace(/\?/, ext + '?');
    else
        return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) {
    var str = '<object ';
    for (var i in objAttrs)
        str += i + '="' + objAttrs[i] + '" ';
    str += '>';
    for (var i in params)
        str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    str += '<embed ';
    for (var i in embedAttrs)
        str += i + '="' + embedAttrs[i] + '" ';
    str += ' ></embed></object>';

    document.write(str);
}

function AC_FL_RunContent() {
    var ret =
    AC_GetArgs
    (arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
    AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent() {
    var ret =
    AC_GetArgs
    (arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
    AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType) {
    var ret = new Object();
    ret.embedAttrs = new Object();
    ret.params = new Object();
    ret.objAttrs = new Object();
    for (var i = 0; i < args.length; i = i + 2) {
        var currArg = args[i].toLowerCase();

        switch (currArg) {
            case "classid":
                break;
            case "pluginspage":
                ret.embedAttrs[args[i]] = args[i + 1];
                break;
            case "src":
            case "movie":
                args[i + 1] = AC_AddExtension(args[i + 1], ext);
                ret.embedAttrs["src"] = args[i + 1];
                ret.params[srcParamName] = args[i + 1];
                break;
            case "onafterupdate":
            case "onbeforeupdate":
            case "onblur":
            case "oncellchange":
            case "onclick":
            case "ondblClick":
            case "ondrag":
            case "ondragend":
            case "ondragenter":
            case "ondragleave":
            case "ondragover":
            case "ondrop":
            case "onfinish":
            case "onfocus":
            case "onhelp":
            case "onmousedown":
            case "onmouseup":
            case "onmouseover":
            case "onmousemove":
            case "onmouseout":
            case "onkeypress":
            case "onkeydown":
            case "onkeyup":
            case "onload":
            case "onlosecapture":
            case "onpropertychange":
            case "onreadystatechange":
            case "onrowsdelete":
            case "onrowenter":
            case "onrowexit":
            case "onrowsinserted":
            case "onstart":
            case "onscroll":
            case "onbeforeeditfocus":
            case "onactivate":
            case "onbeforedeactivate":
            case "ondeactivate":
            case "type":
            case "codebase":
                ret.objAttrs[args[i]] = args[i + 1];
                break;
            case "width":
            case "height":
            case "align":
            case "vspace":
            case "hspace":
            case "class":
            case "title":
            case "accesskey":
            case "name":
            case "id":
            case "tabindex":
                ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i + 1];
                break;
            default:
                ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i + 1];
        }
    }
    ret.objAttrs["classid"] = classid;
    if (mimeType) ret.embedAttrs["type"] = mimeType;
    return ret;
}
(function($) {
    $.extend($.fx.step, { backgroundPosition: function(fx) {
        if (fx.state === 0 && typeof fx.end == 'string') { var start = $.curCSS(fx.elem, 'backgroundPosition'); start = toArray(start); fx.start = [start[0], start[2]]; var end = toArray(fx.end); fx.end = [end[0], end[2]]; fx.unit = [end[1], end[3]]; }
        var nowPosX = []; nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0]; nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1]; fx.elem.style.backgroundPosition = nowPosX[0] + ' ' + nowPosX[1]; function toArray(strg) { strg = strg.replace(/left|top/g, '0px'); strg = strg.replace(/right|bottom/g, '100%'); strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g, "$1px$2"); var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/); return [parseFloat(res[1], 10), res[2], parseFloat(res[3], 10), res[4]]; } 
    } 
    });
})(jQuery);
function dropmenu(active, show) { document.getElementById(active).className = "active"; document.getElementById(show).style.visibility = "visible"; }
function hidemenu(active, show) { document.getElementById(active).className = ""; document.getElementById(show).style.visibility = "hidden"; }
function dropmenu1(show) { document.getElementById(show).style.visibility = "visible"; }
function hidemenu1(show) { document.getElementById(show).style.visibility = "hidden"; }
/* JsUpperTab */
function GetAllTabContent(tabid, divid, tabno, ulid, ultabid) {
    if (tabid != null && divid != null) {
        var xmlHttpReq = false;
        var self = this;
        if (window.XMLHttpRequest) {
            self.xmlHttpReq = new XMLHttpRequest();
        }
        else if (window.ActiveXObject) {
            self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
        }
        document.getElementById(divid).innerHTML = "<span class=\"tabLoader\"><img src=\"images/ajax_loader.gif\" alt=\"wait\"></span>";
        self.xmlHttpReq.open('POST', strDomain + "ajaxUpperTab.aspx", true);
        self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        self.xmlHttpReq.onreadystatechange = function() {
            if (self.xmlHttpReq.readyState == 4) {
                if (self.xmlHttpReq.responseText != null && self.xmlHttpReq.responseText != '') {
                    var GetValue = new Array();
                    if (self.xmlHttpReq.responseText.indexOf('~' != -1)) {
                        GetValue = self.xmlHttpReq.responseText.split('~');
                        if (GetValue[0].toString() != "") {
                            if (GetValue[0].toString() == "1") {
                                document.getElementById(divid).innerHTML = GetValue[1].toString();
                                if (document.getElementById(divid).style.display == 'none') {
                                    document.getElementById(divid).style.display = 'block';
                                }
                                var arr = document.getElementById(ultabid).getElementsByTagName('li');
                                for (var i = 0; i < arr.length; i++) {
                                    arr[i].className = "";
                                }

                                document.getElementById(tabid).className = "selected";
                            }
                            else {
                                document.getElementById(divid).innerHTML = GetValue[1].toString();
                            }
                        }
                    }

                }
            }
        }
        self.xmlHttpReq.send("mode=tabContent&tabid=" + tabid + "&tabno=" + tabno + "&r=" + Math.random() + "");
    }
}


function selectTab(obj) {
    var Anchors = new Array();
    var objThis = null;
    Anchors = obj.getElementsByTagName('a');
    var i = 0;
    var CTRL = 0;
    for (i = 0; i < Anchors.length; i++) {
        if (Anchors[i].className == "selected") {
            objThis = Anchors[i];
            CTRL = i;
            break;
        }
    }
    var DIV = objThis.getAttribute("rel");
    var UL = objThis.getAttribute("name");
    GetFirstTabContent(objThis.id, DIV, CTRL + 1, UL, 'ultabid');
}

function GetFirstTabContent(obj) {
    $('#ultabid a').each(function() {
        $(this).removeClass("selected");
        $("div[id=" + $(this).attr("name") + "]").css("display", "none");
    });
    $('#ultabid a:first').addClass("selected");
    $("#tcontent1").css("display", "block");

}
    
