
﻿var SlavinTube={Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,Gecko:navigator.userAgent.indexOf('Gecko')>-1&&navigator.userAgent.indexOf('KHTML')==-1},Object:{isElement:function(object){return object&&object.nodeType==1;},isArray:function(object){return object&&object.constructor===Array;},isHash:function(object){return object instanceof Hash;},isFunction:function(object){return typeof object=="function";},isString:function(object){return typeof object=="string";},isNumber:function(object){return typeof object=="number";},isUndefined:function(object){return typeof object=="undefined";},isNull:function(object){return object==null;},isNotNull:function(object){return object!=null;},isEmptyText:function(object){return trim(object.value)=="";},toString:function(object){return typeof object;}},Validation:{isEmpty:function(element){if(trim($val(element))=="")return true;return false;},isEmail:function(string){var pattern=/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;return(string.search(pattern)!=-1);},isDomain:function(string){string=string.toLowerCase();if(string.indexOf("http")!=-1)return true;else return false;},isName:function(strName){if(strName.length<2)return false;var NotAllowed="~!@#$%^&*()<>[]{}_|.\/*+:?\"1234567890";for(var i=0;i<NotAllowed.length;i++){if(strName.indexOf(NotAllowed.charAt(i))!=-1)return false;}if(strName.indexOf("\"")!=-1)return false;return true;},isSpaces:function(element){return $val("ctl00_BasicMasterPage_txtPassword").indexOf(" ")>-1},isPassword:function(element){var strPass=$val(element);var NotAllowed="אבגדהוזחטיכלמנסעפצקרשת";if(strPass.length<4)return false;for(var i=0;i<NotAllowed.length;i++){if(strPass.indexOf(NotAllowed.charAt(i))>-1)return false;}return true;},isNumber:function(e){if(!e)e=window.event;var charCode=(e.which)?e.which:e.keyCode;if(charCode>31&&(charCode<48||charCode>57)){return false;}return true;},isCapLock:function(e,elementName){if(!e)window.event;var KeyCode=e.keyCode?e.keyCode:e.which;var ShiftKey=e.shiftKey?e.shiftKey:((KeyCode==16)?true:false);if(((KeyCode>=65&&KeyCode<=90)&&!ShiftKey)||((KeyCode>=97&&KeyCode<=122)&&ShiftKey))document.getElementById(elementName).style.display="";else document.getElementById(elementName).style.display="none";},enterFalse:function(e){if(!e)e=window.event;var KeyChar=e.which||e.keyCode;if(Number(KeyChar)==13){return false;}return true;}}};function loadXMLDoc(Name){if(window.ActiveXObject)
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");else
if(document.implementation&&document.implementation.createDocument)
var xmlDoc=document.implementation.createDocument("","",null);xmlDoc.async=false;xmlDoc.appendChild(xmlDoc.createElement(Name));return(xmlDoc);}
function loadEmptyXMLDoc(){if(window.ActiveXObject)var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");else if(document.implementation&&document.implementation.createDocument)var xmlDoc=document.implementation.createDocument("","",null);xmlDoc.async=false;return(xmlDoc);}
function xToString(xml)
{if(xml.xml)
return(xml.xml);else
if(XMLSerializer)
return new XMLSerializer().serializeToString(xml);else
if(xml.implementation.createLSSerializer)
{var serializer=xml.implementation.createLSSerializer();return serializer.writeToString(xml);}
else
return("");}
function AddSelectSingleNode()
{var IE=!!(window.attachEvent&&!window.opera);if(!IE){Document.prototype.selectNodes=function(XPath,XNode){if(!XNode)XNode=this;this.ns=this.createNSResolver(this.documentElement);this.qI=this.evaluate(XPath,XNode,this.ns,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);aResult=[];for(i=0;i<this.qI.snapshotLength;i++){aResult[i]=this.qI.snapshotItem(i);}return aResult;}
Document.prototype.selectSingleNode=function(XPath,XNode){if(!XNode)XNode=this;this.xI=this.selectNodes(XPath,XNode);return(this.xI.length>0)?this.xI[0]:null;}
Element.prototype.selectNodes=function(XPath){return this.ownerDocument.selectNodes(XPath,this);}
Element.prototype.selectSingleNode=function(XPath){return this.ownerDocument.selectSingleNode(XPath,this);}}}
function loadStringXml(strLoad)
{var xmlDoc=null;if(SlavinTube.Browser.IE)
{xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.loadXML(strLoad);}
else
{var parser=new DOMParser();xmlDoc=parser.parseFromString(strLoad,"text/xml");}
return xmlDoc;}
