﻿var nn6=document.getElementById&&!document.all,myDOM = "",xslStylesheet,xsltProcessor = null,myDOM,isGridVisible=false;
String.prototype.trim=function(){return this.replace(/^\s*|\s*$/g,'');}
String.prototype.ltrim=function(){return this.replace(/^\s*/g,'');}
String.prototype.rtrim=function(){return this.replace(/\s*$/g,'');}
Array.prototype.indexOf=function(n){for(var i=0;i<this.length;i++){if(this[i]===n){return i;}}return -1;}
Array.prototype.indexOf=function(n){for(var i=0;i<this.length;i++){if(this[i]===n){return i;}}return -1;}
Array.prototype.lastIndexOf=function(n){var i=this.length;while(i--){if(this[i]===n){return i;}}return -1;}
Array.prototype.forEach=function(f){var i=this.length,j,l=this.length;for(i=0;i<l;i++){if((j=this[i])){f(j);}}};
Array.prototype.insert=function(i,v){if(i>=0){var a=this.slice(),b=a.splice(i);a[i]=value;return a.concat(b);}}
Array.prototype.shuffle=function(){var i=this.length,j,t;while(i--){j=Math.floor((i+1)*Math.random());t=arr[i];arr[i]=arr[j];arr[j]=t;}}
Array.prototype.unique=function(){var a=[],i;this.sort();for(i=0;i<this.length;i++){if(this[i]!==this[i+1]){a[a.length]=this[i];}}return a;}
if(typeof Array.prototype.concat==='undefined'){Array.prototype.concat=function(a){for(var i=0,b=this.copy();i<a.length;i++){b[b.length]=a[i];}return b;};}
if(typeof Array.prototype.copy==='undefined'){Array.prototype.copy=function(a){var a=[],i=this.length;while(i--){a[i]=(typeof this[i].copy!=='undefined')?this[i].copy():this[i];}return a;};}
if(typeof Array.prototype.pop==='undefined'){Array.prototype.pop=function(){var b=this[this.length-1];this.length--;return b;};}
if(typeof Array.prototype.push==='undefined'){Array.prototype.push=function(){for(var i=0,b=this.length,a=arguments;i<a.length;i++){this[b+i]=a[i];}return this.length;};}
if(typeof Array.prototype.shift==='undefined'){Array.prototype.shift=function(){for(var i=0,b=this[0];i<this.length-1;i++){this[i]=this[i+1];}this.length--;return b;};}
if(typeof Array.prototype.slice==='undefined'){Array.prototype.slice=function(a,c){var i=0,b,d=[];if(!c){c=this.length;}if(c<0){c=this.length+c;}if(a<0){a=this.length-a;}if(c<a){b=a;a=c;c=b;}for(i;i<c-a;i++){d[i]=this[a+i];}return d;};}
if(typeof Array.prototype.splice==='undefined'){Array.prototype.splice=function(a,c){var i=0,e=arguments,d=this.copy(),f=a;if(!c){c=this.length-a;}for(i;i<e.length-2;i++){this[a+i]=e[i+2];}for(a;a<this.length-c;a++){this[a+e.length-2]=d[a-c];}this.length-=c-e.length+2;return d.slice(f,f+c);};}
if(typeof Array.prototype.unshift==='undefined'){Array.prototype.unshift=function(a){this.reverse();var b=this.push(a);this.reverse();return b;};}
function AError(str){/*alert(str);*/}

function RedirectIt(){window.location = JMainSitePath +"website/Diamond_Search_DiamondSearchBasic.asp?Cat_id=79";}
function CreateRequestObject(){var temp=null;if (window.XMLHttpRequest){temp=new XMLHttpRequest();}else if (window.ActiveXObject){temp=new ActiveXObject("Microsoft.XMLHTTP");}else {temp =null;}return temp;}
function SendRequest(obj,url,method){  obj.open("GET", url, false);if (window.XMLHttpRequest){obj.send(null);}else if (window.ActiveXObject){obj.send("");}}
function xmlhttpChange(){ if (http.readyState==4){if (http.status==200){}else{}}}
function GetText(obj){   return obj.responseText;}
function CreateXmlObject(){var temp=null;if (window.ActiveXObject){temp = new ActiveXObject("Microsoft.XMLDOM");temp.async=false;}else if (document.implementation && document.implementation.createDocument){temp = document.implementation.createDocument("","",null);}else {temp =null;}return temp;}
function loadxml(obj,str)
{
    if (window.ActiveXObject)
    {   
        obj=new ActiveXObject("Microsoft.XMLDOM");
        obj.async="false";
        obj.loadXML(str);
    }
    else if (document.implementation && document.implementation.createDocument)
    {
        var parser = new DOMParser();
        obj = parser.parseFromString(str, "text/xml"); 
    }
    return obj;
}
function GetXSLTProcessorObj(xmlobj,xslobj)
{
    var resultDocument="";
    try
    {
        xsltProcessor = new XSLTProcessor();
        xsltProcessor.importStylesheet(xslobj);
        resultDocument = xsltProcessor.transformToDocument(xmlobj);
        var xmls = new XMLSerializer();
        var output = xmls.serializeToString(resultDocument);
    }catch(e)
    {
        AError("GetXSLTProcessorObj:"+e.message);
    }
    return resultDocument;
}
function TransFormNode(xmlobj,strxsldata)
{
    var temp = null;
    temp = CreateXmlObject();
    temp = loadxml(temp,strxsldata);
    if (window.ActiveXObject)
    {
        return xmlobj.transformNode(temp);
    }
    else if (document.implementation && document.implementation.createDocument)
    {
        var str = TransformToDocumentDom(GetXSLTProcessorObj(xmlobj,temp));
        return str;
    }
    else
    {
        return null;
    }
}
function TransformToDocumentDom(doc)
{
    var str = null,obj=null,strattribute=null,strValue="";
    obj=doc.childNodes;
    str = "";
    for(var i=0;i<doc.childNodes.length;i++)
    {
        if(obj[i].nodeName != "#text")
        {  
            str += "<" + obj[i].nodeName;strattribute = obj[i].attributes;
            try
            {
                for(var j=0;j<strattribute.length;j++)
                {
                    strValue = strattribute[j].nodeValue;
                    str += " "+strattribute[j].nodeName+"=\""+strValue.trim()+"\"";strValue="";
                }
            }
            catch(e){}
            
            str += ">";str += TransformToDocumentDom(obj[i]);
            str += "</"+obj[i].nodeName+">";
       }
       else
       {
            if(stripWhitespace(obj[i].nodeValue)=="")
            {
                str += "&nbsp;";
            }
            else
            {
                strValue = obj[i].nodeValue;
                str += strValue.trim();
                strValue="";
            }
       }
    }
    return str;
}
function GetNodeValue(tempxml,id,str){try{var table,NewDataSet,tablelength,i,ID,Desc,temp;NewDataSet = tempxml.getElementsByTagName("NewDataSet");table = NewDataSet[0].getElementsByTagName("Table");tablelength = NewDataSet[0].getElementsByTagName("Table").length;for(i=0;i<tablelength;i++){   ID = table[i].getElementsByTagName("ID");if(ID[0].firstChild.nodeValue!=null && ID[0].firstChild.nodeValue==id){temp = table[i].getElementsByTagName(str);break;}}return temp[0].firstChild.nodeValue;}catch(e){return "";}}
function GetNodeValue1(tempxml,id,str){try{var table,NewDataSet,tablelength,i,ID,Desc,temp;NewDataSet = tempxml.getElementsByTagName("NewDataSet");table = NewDataSet[0].getElementsByTagName("Table");tablelength = NewDataSet[0].getElementsByTagName("Table").length;for(i=0;i<tablelength;i++){   ID = table[i].getElementsByTagName("PID"); if(ID[0].firstChild.nodeValue!=null && ID[0].firstChild.nodeValue==id){temp = table[i].getElementsByTagName(str);break;}}return temp[0].firstChild.nodeValue;}catch(e){return "";}}
function findPosX(obj){var curleft = 0;try{if (obj.offsetParent){while (obj.offsetParent){curleft += obj.offsetLeft;obj = obj.offsetParent;}}else if (obj.x)curleft += obj.x;}catch(e){}return curleft;}
function findPosY(obj){var curtop = 0;try{if (obj.offsetParent){while (obj.offsetParent){curtop += obj.offsetTop;obj = obj.offsetParent;}}else if (obj.y)curtop += obj.y;}catch(e){}return curtop;}
function getScrollX() {var scrOfX = 0, scrOfY = 0;if( typeof( window.pageYOffset ) == 'number' ) {scrOfY = window.pageYOffset;scrOfX = window.pageXOffset;} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {scrOfY = document.body.scrollTop;scrOfX = document.body.scrollLeft;} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {scrOfY = document.documentElement.scrollTop;scrOfX = document.documentElement.scrollLeft;}return scrOfX;}
function getScrollY() {var scrOfX = 0, scrOfY = 0;if( typeof( window.pageYOffset ) == 'number' ) {scrOfY = window.pageYOffset;scrOfX = window.pageXOffset;} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {scrOfY = document.body.scrollTop;scrOfX = document.body.scrollLeft;} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {scrOfY = document.documentElement.scrollTop;scrOfX = document.documentElement.scrollLeft;}return scrOfY ;}
function getBodyWidth(){var W=0,H=0;if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {W = document.body.clientWidth;H = document.body.clientHeight;}else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {W = document.documentElement.clientWidth;H = document.documentElement.clientHeight;}return W;}
function getBodyHeight(){var W=0,H=0;if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {W = document.body.clientWidth;H = document.body.clientHeight;}else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {W = document.documentElement.clientWidth;H = document.documentElement.clientHeight;}return H;}
function stripWhitespace (s){ return stripCharsInBag (s, whitespace)}
function stripCharsInBag (s, bag){ var i;var returnString = "";for (i = 0; i < s.length; i++){var c = s.charAt(i);if (bag.indexOf(c) == -1) returnString += c;}return returnString;}
function addEvent(obj, evType, fun)
{
    if (obj.addEventListener)
    {
        obj.addEventListener(evType,fun,true);
        return true;
    }
    else if(obj.attachEvent)
    {
        var r = obj.attachEvent("on"+evType,fun);
        return r;
    }
    else {return false;}
}

function removeEvent(obj, evType, fun)
{
    if (obj.removeEventListener)
    {
        obj.removeEventListener(evType, fun, false);
        return true;
    } 
    else if (obj.detachEvent)
    {
        var r = obj.detachEvent("on"+evType, fun);
        return r;
    } 
    else 
    {
        alert("Handler could not be removed");
        return false;
    }
}
function createCookie(name,value,days){if (days){var date = new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires = "; expires="+date.toGMTString();}else var expires = "";document.cookie = name+"="+value+expires+"; path=/";}
function readCookie(name){var nameEQ = name + "=";var ca = document.cookie.split(';');for(var i=0;i < ca.length;i++){var c = ca[i];while (c.charAt(0)==' ') c = c.substring(1,c.length);if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);}return null;}
function eraseCookie(name){createCookie(name,"",-1);}

function SetVisible(id)
{
    try
    {
        document.getElementById(id).className = "VISIBLE";
    }
    catch(e)
    {
        AError("SetVisible:"+id+"\n"+e.message);
    }
}

function SetVisibleNN(id){try{document.getElementById(id).className = "VISIBLE";}catch(e){AError("SetVisibleNN:"+id+"\n"+e.message);}}
function SetHide(id){try{document.getElementById(id).className = "HIDE";}catch(e){AError("SetHide:"+id+"\n"+e.message);}}
function SetHideNN(id){try{document.getElementById(id).className = "HIDE";}catch(e){AError("SetHideNN:"+id+"\n"+e.message);}}
function GetClassName(id){try{return document.getElementById(id).className;}catch(e){AError("GetClassName:"+id+"\n"+e.message);}return "";}
function SetClassName(id,strClass){try{document.getElementById(id).className=strClass;}catch(e){AError("SetClassName:"+id+"\n"+e.message);}}
function SetSrc(id,strsrc){try{document.getElementById(id).src=strsrc;}catch(e){AError("SetSrc:"+id+"\n"+e.message);}}
function GetSrc(id){try{return document.getElementById(id).src;}catch(e){AError("GetSrc:"+id+"\n"+e.message);return "";}}
function Svisibile(id,str){try{document.getElementById(id).style.visibility = str;}catch(e){AError("Svisibile:"+id+"\n"+e.message);}}
function Sdisplay(id,str){try{document.getElementById(id).style.display = str;}catch(e){AError("Sdisplay:"+id+"\n"+e.message);}}
function GetCValue(id){try{return document.getElementById(id).value.trim();}catch(e){AError("GetCValue:"+id+"\n"+e.message);return "";}}
function SetCValue(id,strvalue){try{document.getElementById(id).value=strvalue;}catch(e){AError("SetCValue:"+id+"\n"+e.message);}}
function SetInnerHtml(id,strvalue){try{document.getElementById(id).innerHTML=strvalue;}catch(e){AError("SetInnerHtml:"+id+"\n"+e.message);}}
function GetChecked(id){try{return document.getElementById(id).checked;}catch(e){AError("GetChecked:"+id+"\n"+e.message);return "";}}
function SLeftP(id,posp){try{document.getElementById(id).style.left=posp;}catch(e){AError("SLeftP:"+id+"\n"+e.message);}}
function GLeftP(id){try{return document.getElementById(id).style.left;}catch(e){AError("GLeftP:"+id+"\n"+e.message);return "";}}
function STopP(id,posp){try{document.getElementById(id).style.top=posp;}catch(e){AError("STopP:"+id+"\n"+e.message);}}
function GTopP(id){try{return document.getElementById(id).style.top;}catch(e){AError("GTopP:"+id+"\n"+e.message);return "";}}
function SHeightP(id,posp){try{document.getElementById(id).style.height=posp;}catch(e){AError("SHeightP:"+id+"\n"+e.message);return "";}}
function GHeightP(id){try{return document.getElementById(id).style.height;}catch(e){AError("GHeightP:"+id+"\n"+e.message);return "";}}
function SWidthP(id,posp){try{document.getElementById(id).style.width=posp;}catch(e){AError("SWidthP:"+id+"\n"+e.message);}}
function GWidthP(id){try{return document.getElementById(id).style.width;}catch(e){AError("GWidthP:"+id+"\n"+e.message);return "";}}
function GoffsetTopP(id){try{return document.getElementById(id).offsetTop;}catch(e){AError("GoffsetTopP:"+id+"\n"+e.message);return "";}}
function GoffsetHeightP(id){try{return document.getElementById(id).offsetHeight;}catch(e){AError("GoffsetHeightP:"+id+"\n"+e.message);return "";}}
function GoffsetWidthP(id){try{return document.getElementById(id).offsetWidth;}catch(e){AError("GoffsetWidthP:"+id+"\n"+e.message);return "";}}
function SetFocus(id){try{document.getElementById(id).focus();}catch(e){AError("SetFocus:"+id+"\n"+e.message);}}
function popUp(URL){day = new Date();id = day.getTime();eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=650,height=400,left=100,top = 50');");}
function removellcookie()
{
    var c = document.cookie.split(';'),d;   
    for(var i=0;i<c.length;i++)
    {
        d = c[i].split('=');            
        var cooka=d[0].replace(/^\s*|\s*$/g,"");       
        try
        {
            if(cooka=="MSOL%5FBASKET" || cooka=="ASP.NET_SessionId"||cooka=="MYSOLITAIRE_REFERRAL_URL")
            {                
            }
            else
            {
                
                eraseCookie(c[i]);
            }
         }
         catch(e){}
    }
}
function SCursor(id,type){try{document.getElementById(id).style.cursor=type;}catch(e){AError("SCursor:"+id+"\n"+e.message);}}
function SBgColor(id,strvalue){try{document.getElementById(id).style.backgroundColor=strvalue;}catch(e){AError("SBgColor:"+id+"\n"+e.message);}}
function SFontWeight(id,strvalue){try{document.getElementById(id).style.fontWeight=strvalue;}catch(e){AError("SFontWeight:"+id+"\n"+e.message);}}
function SBorderColor(id,strvalue){try{document.getElementById(id).style.borderColor=strvalue;}catch(e){AError("SBorderColor:"+id+"\n"+e.message);}}
function SBorderLeft(id,strvalue){try{document.getElementById(id).style.borderLeft=strvalue;}catch(e){AError("SBorderLeft:"+id+"\n"+e.message);}}
function SBorderRight(id,strvalue){try{document.getElementById(id).style.borderRight=strvalue;}catch(e){AError("SBorderRight:"+id+"\n"+e.message);}}
function SBorderTop(id,strvalue){try{document.getElementById(id).style.borderTop=strvalue;}catch(e){AError("SBorderTop:"+id+"\n"+e.message);}}
function SBorderBottom(id,strvalue){try{document.getElementById(id).style.borderBottom=strvalue;}catch(e){AError("SBorderBottom:"+id+"\n"+e.message);}}
/*try {

//my code

} catch (e) {
Application('errormsg') = ("An exception occurred in the script. Error
name: " + e.name
+ ". Error description: " + e.description
+ ". Error number: " + e.number
+ ". Error message: " + e.message); }*/
