

//======== Constants.js

try
{
var sEnvironment="";
var ImagesFQDN = document.location.protocol + "//f.nanafiles.co.il/";

}catch(e){}


//======== Nana.js

try
{
/************************************************************************/
/*							Constants and variables						*/
/************************************************************************/
var sFP = window.location.protocol + "//" + window.location.host;
try {var sNUI = (new Cookie("NUI")).getCookie().replace(/[+]/g,' ');}catch(ex){}

/************************************************************************/
/*			  				Prototipes and object functions				*/
/************************************************************************/
function trim(str){
   return str.replace(/^\s*|\s*$/g,"");
}

String.prototype.trim = function(){
	return trim(this);
}

function randOrd(a, b){
	return (Math.round(Math.random())-0.5); 
}

function dec2hex(n){
	n = parseInt(n); var c = 'ABCDEF';
	var b = n / 16; var r = n % 16; b = b-(r/16); 
	b = ((b>=0) &&  (b <= 9)) ? b : c.charAt(b-10);    
	return ((r>=0) && (r <= 9)) ? b+''+r : b+''+c.charAt(r-10);
}
	
function UrlEncode(sStr)
{
	var sReturn='';
	for (var i=0;i<sStr.length;i++)
	{
		var iUni=sStr.charCodeAt(i);
		if(iUni>=1488 && iUni<=1514)
		{
			var iAsc=iUni-1264 ;
			sReturn+=escape(String.fromCharCode(iAsc));
		}
		else if(iUni==32) sReturn += escape('+');
		else if(iUni==43) sReturn += '%2b';
		else	sReturn+=escape(sStr.charAt(i));
	}
	return sReturn;
}

function utf8_decode(utftext) {
	var string = "";
	var i = 0;
	var c = c1 = c2 = 0;

	while ( i < utftext.length ) {

		c = utftext.charCodeAt(i);

		if (c < 128) {
			string += String.fromCharCode(c);
			i++;
		}
		else if((c > 191) && (c < 224)) {
			c2 = utftext.charCodeAt(i+1);
			string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
			i += 2;
		}
		else {
			c2 = utftext.charCodeAt(i+1);
			c3 = utftext.charCodeAt(i+2);
			string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
			i += 3;
		}

	}

	return string;
}

function suycDateDiff(start) {
	// This function need to recieve date in format = 20:06 25/12/2001
	// and return how many days it is from today
	var strMonthArray = new Array(12);
	strMonthArray[0]  = "Jan";
	strMonthArray[1]  = "Feb";
	strMonthArray[2]  = "Mar";
	strMonthArray[3]  = "Apr";
	strMonthArray[4]  = "May";
	strMonthArray[5]  = "Jun";
	strMonthArray[6]  = "Jul";
	strMonthArray[7]  = "Aug";
	strMonthArray[8]  = "Sep";
	strMonthArray[9]  = "Oct";
	strMonthArray[10] = "Nov";
	strMonthArray[11] = "Dec";
	
	var text = start.substring(5);	
	
	// the mounth
	var sMounth = text
		sMounth = text.substring(3);
		sMounth = sMounth.substring(1,3) ;
	    if(sMounth.indexOf(0)==0) sMounth = sMounth.substring(1,2);
	     sMounth = strMonthArray[sMounth-1];
	     
	// the day
	var sDay = text;
		sDay = sDay.substring(1,3) ;	
	
	// the year
	var sYear = text ;
	    sYear = sYear.substring(7,11) ;
	
	// all start string again
	start = sDay + " " + sMounth + " " + sYear ;	    	

	var now;
	now  = new Date() ;		
    var iOut = 0;
    var bufferA = Date.parse( start ) ;
    var bufferB = Date.parse( now ) ;    	
    if ( isNaN (bufferA) || isNaN (bufferB) )   return 0 ;            	                        
    var number = bufferB-bufferA ;       
    iOut = parseInt(number / 86400000) ;                  
    return iOut ;
}

/************************************************************************/
/*							Search functions							*/
/************************************************************************/

function defined(o) 
{
	return (typeof(o)!="undefined");
}

function SearchRedirectLocal(e)
{
 if (!defined(e) && defined(window.event)) {
      e = window.event;
  }
  return SearchRedirect(false, (e.target || e.srcElement));
}

function SearchRedirect(bReturnString, frm)
{
	var sParamName, sParamValue,arrSplit,sUrl='';
	var oSearchBar = (!defined(frm))?document.getElementById("SearchBar"):frm;
	var oDiv = new Div(oSearchBar);
	var oArrInput;
	var nNumOfParam = 0;
	var sKeywordParam;
	var sArrIgnore = new Array ('q','serviceAction');
	var arrURL, sOptionId;
	var oQ = oSearchBar.q;
	
	oQ = CleanKeywords(oQ);
		
	if(oQ.value.length < 2 || oQ.value== 'חפשו אתר')
	{
		alert("מילת חיפוש צריכה להכיל לפחות 2 תווים חוקיים"); 
		return false;
	}
	
	if(oSearchBar.serviceAction.value) {
		arrURL = oSearchBar.serviceAction.value.split("|");
	}
	else {
		var oSA = document.getElementsByName('serviceAction');
		for (var i=0;i<oSA.length;i++)
			if(oSA[i].checked)
			{
				sOptionId = oSA[i].id;
				arrURL=oSA[i].value.split("|");
				break;
			}
	}
	
	if(typeof(arrURL) != "undefined") {
		nNumOfParam=arrURL.length;	
	}
		
	// get extra parameters
	if(nNumOfParam > 2)
		for(var i=1;i<nNumOfParam-1;i++)
		{
			arrSplit=arrURL[i].split("=");
			sParamName=arrSplit[0];
			sParamValue=arrSplit[1];
			
			sUrl+='&' + escape(sParamName) + '=' + UrlEncode(sParamValue) ;
		}
	
	if(typeof(arrURL) != "undefined") {
		if(arrURL[0].toLowerCase().indexOf("ftsearch")>=0)
		{
			if(!ValidateSearchString(oQ.value.trim()))
			{
				alert(".מילת חיפוש יכולה להכיל אותיות באנגלית, עברית וספרות");
				return false;
			}
		}
	}
	//debugger;
	oArrInput=oSearchBar.getAllChild('INPUT');
	for (var i=0;i<oArrInput.length;i++)
		if(sArrIgnore[0]!=oArrInput[i].name && sArrIgnore[1]!=oArrInput[i].name )
			if ((oArrInput[i].type=='radio' && oArrInput[i].checked)||oArrInput[i].type!='radio')
				sUrl+='&' + escape(oArrInput[i].name) + '=' + UrlEncode(oArrInput[i].value)
			
	oArrInput=oSearchBar.getAllChild('SELECT');
	for (var i=0;i<oArrInput.length;i++)
		if(sArrIgnore[0]!=oArrInput[i].name && sArrIgnore[1]!=oArrInput[i].name )
			sUrl+='&' + escape(oArrInput[i].name) + '=' + UrlEncode(oArrInput[i].value) ;

	if(typeof(arrURL) != "undefined") {
		sKeywordParam = arrURL[nNumOfParam-1];
	}
	sUrl += '&gr=' 
	sUrl += oSearchBar.g.checked ? '1' : '0' ;
	
	sUrl=sUrl+'&' + escape(sKeywordParam) + '=' + UrlEncode(oQ.value) ;	
	
	if(typeof(arrURL) != "undefined") {
		sUrl= arrURL[0] + '?' +sUrl.substring(1);
	}
	else {
		sUrl= sUrl.substring(1);
	}
	
	if (sOptionId)
		sUrl += "&sbId=" + sOptionId.replace("serviceAction","");
	if (oQ.value!='')
		if (bReturnString)
			return sUrl;
		else {
			parent.location=sUrl ;
			return false;
		}
	else
		return false;		
}

function SelectSearchButton(){
	var sSrbId = RequestQueryString("sbId");
	if (sSrbId != "") {
		var oSrlOldId = document.getElementById("FontSelected1")
		var oSrlId = document.getElementById("FontSelected" + sSrbId)
		var oSrb = document.getElementById("serviceAction" + sSrbId);
		if (oSrb){
			oSrb.checked = true;
			oSrlOldId.style.fontWeight = "normal";
			oSrlId.style.fontWeight = "bold";
		}
	}
}

function ValidateSearchString(sStr){
    
    for (i=0;i<sStr.length;i++)   {
        var iChar=sStr.charCodeAt(i);
        if  (  
                !(
					(iChar==32 ) ||
                    (iChar>=97 && iChar<=122) ||
                    (iChar>=65 && iChar<=90) ||
                    (iChar>=48 && iChar<=57) ||
                    (iChar>=1488 && iChar<=1514) 
                )
            )
            {
                return false;
            }
    }
    return true    
}

function CleanKeywords(oKeyword) {
	var KeywordValue = oKeyword.value
	KeywordValue = KeywordValue.replace('http://', '');
	KeywordValue = KeywordValue.replace('www.', '');
    KeywordValue = KeywordValue.replace('.com', '');
    KeywordValue = KeywordValue.replace('.co', '');
    KeywordValue = KeywordValue.replace('.net', '');
    KeywordValue = KeywordValue.replace('.org', '');
    KeywordValue = KeywordValue.replace('.gov', '');
    KeywordValue = KeywordValue.replace('.net', '');
    KeywordValue = KeywordValue.replace('.il', '');
    KeywordValue = KeywordValue.replace('planet.nana', '');
    KeywordValue = KeywordValue.replace('members.nana', '');
    KeywordValue = KeywordValue.replace('.asp', '');
    KeywordValue = KeywordValue.replace('.htm', '');
    KeywordValue = KeywordValue.replace('.html', '');
    KeywordValue = KeywordValue.replace(/\?/g, ' ');
    KeywordValue = KeywordValue.replace(/!/g, ' ');
    KeywordValue = KeywordValue.replace(/;/g, ' ');
    KeywordValue = KeywordValue.replace(/\+/g, ' ');
    KeywordValue = KeywordValue.replace(/-/g, ' ');
    KeywordValue = KeywordValue.replace(/~/g, ' ');
    KeywordValue = KeywordValue.replace(/%/g, ' ');
    KeywordValue = KeywordValue.replace(/$/g, ' ');
    KeywordValue = KeywordValue.replace(/&/g, ' ');
    KeywordValue = KeywordValue.replace(/^/g, ' ');
    KeywordValue = KeywordValue.replace(/^/g, ' ');
    KeywordValue = KeywordValue.replace(/@/g, ' ');
    KeywordValue = KeywordValue.replace(/=/g, ' ');
    KeywordValue = KeywordValue.replace('/', ' ');
    KeywordValue = KeywordValue.replace(/\[/g, ' ');
    KeywordValue = KeywordValue.replace(/]/g, ' ');
    KeywordValue = KeywordValue.replace(/\(/g, ' ');
    KeywordValue = KeywordValue.replace(/\)/g, ' ');
    KeywordValue = KeywordValue.replace(/\*/g, ' ');
    KeywordValue = KeywordValue.replace(/#/g, ' ');
    KeywordValue = KeywordValue.replace(/}/g, ' ');
    KeywordValue = KeywordValue.replace(/{/g, ' ');
    KeywordValue = KeywordValue.replace(/,/g, ' ');
    KeywordValue = KeywordValue.replace(/</g, ' ');
    KeywordValue = KeywordValue.replace(/>/g, ' ');
	//alert(KeywordValue);
	oKeyword.value = trim(KeywordValue);
	return oKeyword;
}

function SearchNoValidateSubmit(){
	return true;
}

function DecodeKeyword(sKeyword) {
    var sNewKeyword = "";
    
    if (typeof (sKeyword) != "undefined") {
        var aWords = sKeyword.split("+");

        for (j = 0; j < aWords.length; j++) {
            var aLetters = aWords[j].split("%D7");
            if (aLetters.length > 1) {
                for (i = 1; i < aLetters.length; i++) {
                    sNewKeyword += "%" + dec2hex(parseInt("0x" + aLetters[i].substr(1, 2)) + 0x50);
                }
            }
            else {
                sNewKeyword += aWords[j];
            }
            if (j < aWords.length - 1) {
                sNewKeyword += "+";
            }
        }
    }
	return sNewKeyword;
}

/************************************************************************/
/*							Nana DOM and HTML functions					*/
/************************************************************************/
//Keep this function for backward compatibility
function NanaPopUp (sPopupWinArgs) {
	NanaPopUpReturn(sPopupWinArgs)
}

//This function return the refrence of the popup
//Usage:
//	NanaPopUpReturn ('TargetURL, width, height, scrollbars')
//Usage examples:
//	NanaPopUpReturn ('http://www.nana10.co.il, 400, 300, yes')
//	NanaPopUpReturn ('http://www.nana10.co.il, width=400, height=300, scrollbars=yes')
function NanaPopUpReturn (sPopupWinArgs) {					 
	if(sPopupWinArgs != '') {
		var sURL		= '';
		var sWidth		= '';
		var sHeight		= '';
		var sFeatures	= '';
		var sScrollBars	= '';
		
		var oNewWindow;					
		var sName = 'PopupWin';
		var sFeatures	= '';
		var arrArgs		= sPopupWinArgs.split(",");

		typeof(arrArgs[0]) == 'string' ? sURL = arrArgs[0] : {};
		if (typeof(arrArgs[1]) == 'string')
			sWidth = arrArgs[1].toLowerCase() 
		else {
			parent.location.href=sURL; 
			self.focus();
			return(null);
		}
		typeof(arrArgs[2]) == 'string' ? sHeight = arrArgs[2].toLowerCase() : {};
		typeof(arrArgs[3]) == 'string' ? sScrollBars = arrArgs[3].toLowerCase() : {};
		
		sFeatures = 'top=10, left=10';
		
		if (sWidth == "width=0") {
			sWidth = '';
		} else if (sWidth.indexOf('width')==-1) {
			sWidth = ', width=' + sWidth;
		} 
		
		if (sHeight == "height=0") {
			sHeight = '';
		} else if (sHeight.indexOf('height')==-1) {
			sHeight = ', height=' + sHeight;
		} 
		
		if (sScrollBars != '' && sScrollBars.indexOf('scrollbars')==-1) {
			sScrollBars = ', scrollbars=' + sScrollBars;
		} 

		sFeatures = sFeatures + sWidth + sHeight + sScrollBars
		
		oNewWindow = window.open (sURL,sName,sFeatures);
		return oNewWindow;
	}
}

// get query string paramter and return the value
function RequestQueryString(KeyName, qrStr) {
    if (typeof (qrStr) == "undefined") {
		var qrStr = window.location.search;
	}
	else {
		var arrHref = qrStr.split("?");
		qrStr = (arrHref.length < 2) ? arrHref[0] : arrHref[1];
	}

	var spQrStr = qrStr.substring(1);
	var arr = spQrStr.split("&");

	for (var i = 0; i < arr.length; i++) {
		// splits each of field-value pair
		var index = arr[i].indexOf("=");
		var key = arr[i].substring(0, index);
		var val = arr[i].substring(index + 1);

		if (key == KeyName)
			return val;
	}
}

function GetWindowWidth() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth;
	} else if( document.documentElement &&
		( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		myWidth = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myWidth = document.body.clientWidth;
	}
	return myWidth;
}

function GetWindowHeight() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		myHeight = window.innerHeight;
	} else if( document.documentElement &&
		( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myHeight = document.body.clientHeight;
	}
	return myHeight;
}

function getScrollXY() {
  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, scrOfY ];
}

// This function save cookie - deprecated, use class
function saveCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000))		
		var expires = "; expires="+date.toGMTString()
	}
	else expires = ""
		document.cookie = name+"="+value+expires+"; path=/"				
}

// This function read the cookie that was saved by saveCookie function - deprecated, use class
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 1;
}

function XmlLoader(source) {
    var xmlDoc;
    if (!source.documentElement) {
        source = source || '<root></root>';
        try {
            xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
            xmlDoc.async = "false";
            xmlDoc.loadXML(source);
        }
        catch (e) {
            try {
                parser = new DOMParser();
                xmlDoc = parser.parseFromString(source, "text/xml");
            }
            catch (e) {
                // alert(e.message);
                return null;
            }
        }
        source = xmlDoc;
    }
    return source;
};


/************************************************************************/
/*							Nana functionality							*/
/************************************************************************/

function displayWallashopsTemplate(sTargetId, sTemplateId){
	$(function(){
		if(typeof oWsProducts != "undefined")
		{
			if(typeof oWsProducts.error == "undefined")
			{
				oWsProducts.vertical_template.sort(randOrd);
				oWsProducts.main_template.sort(randOrd);
				oWsProducts.horizontal_template.sort(randOrd);
				$("#" + sTargetId).setTemplateElement(sTemplateId,null,{filter_data: false});
				$("#" + sTargetId).processTemplate(oWsProducts);
			}
		}
	});
}

function SetGirafaCheckbox(flag, Formobject){
	if (flag) {
		Formobject.gr.value=1;
	}
	else {
		Formobject.gr.value=0;
	}
}

var naPageRefreshEnabled = true;

function SetPageRefresh(iTimeoutInterval){
	if (iTimeoutInterval > 0){
		window.setTimeout(function(){PerformPageRefresh(iTimeoutInterval);},iTimeoutInterval);
	}
}

function PerformPageRefresh(iTimeoutInterval){
	//Perform page refresh or set another try after interval
	if (naPageRefreshEnabled){
		document.location.href = document.location.href;
	}
	else {
		window.setTimeout(function(){PerformPageRefresh(iTimeoutInterval);},iTimeoutInterval);
	}
}

function TogglePageRefresh(bVal){
	naPageRefreshEnabled = bVal;
}

function CheckSurveyType1Form()	{
	var bFormFilled = true; 
	var bQuestionFilled = false;

	for (i=0; i<document.getElementsByName("QuestionID").length; i++)
	{
		bQuestionFilled = false;

		for (j=0; j<document.getElementsByName(document.getElementsByName("QuestionID")[i].value).length; j++)
		{
			if (document.getElementsByName(document.getElementsByName("QuestionID")[i].value)[j].checked == true) {
				bQuestionFilled = true;
				break;
			}
		}
		if ( bQuestionFilled != true){
			bFormFilled = false;
			break;
		}
	}
	return bFormFilled;
}
	
function CheckSurveyType2Form()	{	
	if(CheckSurveyType1Form()) {	
		if ( document.getElementById("FirstName").value!='' && document.getElementById("LastName").value!='' && document.getElementById("Address").value!='' && 	(new Input(document.getElementById("Email")).CheckEmail()) ) 
				{	
					new Div (document.getElementById("oMsg")).Open();
					new Div (document.getElementById("oMsgBold")).Close();
					return true;
				}
				else 
				{
					if (document.getElementById("FirstName").value=='' || document.getElementById("LastName").value=='' || document.getElementById("Address").value=='' )
						document.getElementById("oMsgBold").innerHTML="נא למלא את כל השדות המסומנים בכוכבית";
					else 
						document.getElementById("oMsgBold").innerHTML="שדה דואר אלקטרוני לא תקין";
					
					new Div (document.getElementById("oMsg")).Close();
					new Div (document.getElementById("oMsgBold")).Open();
					return false;
				}
			}
	document.getElementById("oMsgBold").innerHTML="אנא השב על כל השאלות.";
	new Div (document.getElementById("oMsg")).Close();		
	new Div (document.getElementById("oMsgBold")).Open();
	return false;
}


function PopUpResizeTicker() {
	var iWidth=496;
	var iOffsetY=90;
	window.moveTo(0,0);
	window.resizeTo(iWidth,(new Div(document.getElementById("oTickerBody")).getHeight())+iOffsetY);
	window.focus();		
}

function ValidateForm(){
	var dt=document.frmSample.txtDate
	if (isDate(dt.value)==false){
		dt.focus()
		return false
	}
    return true
 }

 function OpenGameWindow(sLink, sTitle) {
     
	sTitle = sTitle.replace("'", "`");
	var typeid = RequestQueryString("typeid", sLink);
	if (typeid == "" || typeof (typeid) == "undefined") {
		sLink += "&typeid=5";
	}
	else if(typeid != 5 && typeid != ""){
		sLink = sLink.replace("typeid=" + typeid, "typeid=5");
	}
	window.open(sLink + "&GameN=" + sTitle, "", "width=1024,height=910,resizable=1,scrollbars=1");	
}

/************************************************************************/
/*							Plugin detection							*/
/************************************************************************/
var PluginDetect = {
    handler: function(c, b, a) {
        return function() {
            c(b, a)
        }
    },
    isDefined: function(b) {
        return typeof b != "undefined"
    },
    isArray: function(b) {
        return (b && b.constructor === Array)
    },
    isFunc: function(b) {
        return typeof b == "function"
    },
    isString: function(b) {
        return typeof b == "string"
    },
    num: function(a) {
        return (this.isString(a) && (/\d/).test(a))
    },
    getNumRegx: /[\d][\d\.\_,-]*/,
    splitNumRegx: /[\.\_,-]/g,
    getNum: function(b, c) {
        var d = this, a = d.num(b) ? (d.isDefined(c) ? new RegExp(c) : d.getNumRegx).exec(b) : null;
        return a ? a[0].replace(d.splitNumRegx, ",") : null
    },
    compareNums: function(h, f, d) {
        var e = this, c, b, a, g = parseInt;
        if (e.num(h) && e.num(f)) {
            if (e.isDefined(d) && d.compareNums) {
                return d.compareNums(h, f)
            }
            c = h.split(e.splitNumRegx);
            b = f.split(e.splitNumRegx);
            for (a = 0; a < Math.min(c.length, b.length); a++) {
                if (g(c[a], 10) > g(b[a], 10)) {
                    return 1
                }
                if (g(c[a], 10) < g(b[a], 10)) {
                    return -1
                }
            }
        }
        return 0
    },
    formatNum: function(b) {
        var c = this, a, d;
        if (!c.num(b)) {
            return null
        }
        d = b.replace(/\s/g, "").split(c.splitNumRegx).concat(["0", "0", "0", "0"]);
        for (a = 0; a < 4; a++) {
            if (/^(0+)(.+)$/.test(d[a])) {
                d[a] = RegExp.$2
            }
        }
        if (!(/\d/).test(d[0])) {
            d[0] = "0"
        }
        return d.slice(0, 4).join(",")
    },
    $$hasMimeType: function(a) {
        return function(d) {
            if (!a.isIE) {
                var c, b, e, f = a.isString(d) ? [d] : d;
                for (e = 0; e < f.length; e++) {
                    if (/[^\s]/.test(f[e]) && (c = navigator.mimeTypes[f[e]]) && (b = c.enabledPlugin) && (b.name || b.description)) {
                        return c
                    }
                }
            }
            return null
        }
    },
    findNavPlugin: function(g, d) {
        var a = this.isString(g) ? g : g.join(".*"), e = d === false ? "" : "\\d", b, c = new RegExp(a + ".*" + e + "|" + e + ".*" + a, "i"), f = navigator.plugins;
        for (b = 0; b < f.length; b++) {
            if (c.test(f[b].description) || c.test(f[b].name)) {
                return f[b]
            }
        }
        return null
    },
    AXO: window.ActiveXObject,
    getAXO: function(b, a) {
        var g = null, f, d = false, c = this;
        try {
            g = new c.AXO(b);
            d = true
        }
        catch (f) {
        }
        if (c.isDefined(a)) {
            delete g;
            return d
        }
        return g
    },
    convertFuncs: function(f) {
        var a, g, d, b = /^[\$][\$]/, c = {};
        for (a in f) {
            if (b.test(a)) {
                c[a] = 1
            }
        }
        for (a in c) {
            try {
                g = a.slice(2);
                if (g.length > 0 && !f[g]) {
                    f[g] = f[a](f)
                }
            }
            catch (d) {
            }
        }
    },
    initScript: function() {
        var $ = this, nav = navigator, userAgent = $.isString(nav.userAgent) ? nav.userAgent : "", vendor = $.isString(nav.vendor) ? nav.vendor : "", platform = $.isString(nav.platform) ? nav.platform : "";
        $.OS = (/win/i).test(platform) ? 1 : ((/mac/i).test(platform) ? 2 : ((/linux/i).test(platform) ? 3 : 4));
        $.convertFuncs($);
        $.isIE = /*@cc_on!@*/
        false;
        $.IEver = $.isIE && ((/MSIE\s*(\d\.?\d*)/i).exec(userAgent)) ? parseFloat(RegExp.$1, 10) : -1;
        $.ActiveXEnabled = false;
        if ($.isIE) {
            var x, progid = ["Msxml2.XMLHTTP", "Msxml2.DOMDocument", "Microsoft.XMLDOM", "ShockwaveFlash.ShockwaveFlash", "TDCCtl.TDCCtl", "Shell.UIHelper", "Scripting.Dictionary", "wmplayer.ocx"];
            for (x = 0; x < progid.length; x++) {
                if ($.getAXO(progid[x], 1)) {
                    $.ActiveXEnabled = true;
                    break
                }
            }
            $.head = $.isDefined(document.getElementsByTagName) ? document.getElementsByTagName("head")[0] : null
        }
        $.isGecko = !$.isIE && $.isString(navigator.product) && (/Gecko/i).test(navigator.product) && (/Gecko\s*\/\s*\d/i).test(userAgent);
        $.GeckoRV = $.isGecko ? $.formatNum((/rv\s*\:\s*([\.\,\d]+)/i).test(userAgent) ? RegExp.$1 : "0.9") : null;
        $.isSafari = !$.isIE && (/Safari\s*\/\s*\d/i).test(userAgent) && (/Apple/i).test(vendor);
        $.isChrome = !$.isIE && (/Chrome\s*\/\s*\d/i).test(userAgent);
        $.isOpera = !$.isIE && (/Opera\s*[\/]?\s*\d/i).test(userAgent);
        ;
        $.addWinEvent("load", $.handler($.runWLfuncs, $));

    },
    init: function(d, a) {
        var c = this, b;
        if (!c.isString(d)) {
            return -3
        }
        if (d.length == 1) {
            c.getVersionDelimiter = d;
            return -3
        }
        b = c[d.toLowerCase().replace(/\s/g, "")];
        if (!b || !b.getVersion) {
            return -3
        }
        c.plugin = b;
        if (!c.isDefined(b.installed) || a == true) {
            b.installed = b.version = b.version0 = b.getVersionDone = null;
            b.$ = c
        }
        c.garbage = false;
        if (c.isIE && !c.ActiveXEnabled) {
            if (b !== c.java) {
                return -2
            }
        }
        return 1
    },
    fPush: function(b, a) {
        var c = this;
        if (c.isArray(a) && (c.isFunc(b) || (c.isArray(b) && b.length > 0 && c.isFunc(b[0])))) {
            a[a.length] = b
        }
    },
    callArray: function(b) {
        var c = this, a;
        if (c.isArray(b)) {
            for (a = 0; a < b.length; a++) {
                if (b[a] === null) {
                    return
                }
                c.call(b[a]);
                b[a] = null
            }
        }
    },
    call: function(c) {
        var b = this, a = b.isArray(c) ? c.length : -1;
        if (a > 0 && b.isFunc(c[0])) {
            c[0](b, a > 1 ? c[1] : 0, a > 2 ? c[2] : 0, a > 3 ? c[3] : 0)
        }
        else {
            if (b.isFunc(c)) {
                c(b)
            }
        }
    },
    $$isMinVersion: function(a) {
        return function(h, g, d, c) {
            var e = a.init(h), f, b = -1;
            if (e < 0) {
                return e
            }
            f = a.plugin;
            g = a.formatNum(typeof g == "number" ? g.toString() : (a.isString(g) ? a.getNum(g) : "0"));
            if (!a.num(g)) {
                return -3
            }
            if (f.getVersionDone != 1) {
                f.getVersion(d, c);
                if (f.getVersionDone === null) {
                    f.getVersionDone = 1
                }
            }
            a.cleanup();
            if (f.installed !== null) {
                b = f.installed <= 0.5 ? f.installed : (f.version === null ? 0 : (a.compareNums(f.version, g, f) >= 0 ? 1 : -1))
            }
            return b
        }
    },
    getVersionDelimiter: ",",
    $$getVersion: function(a) {
        return function(g, d, c) {
            var e = a.init(g), f, b;
            if (e < 0) {
                return null
            }
            f = a.plugin;
            if (f.getVersionDone != 1) {
                f.getVersion(d, c);
                if (f.getVersionDone === null) {
                    f.getVersionDone = 1
                }
            }
            a.cleanup();
            b = (f.version || f.version0);
            return b ? b.replace(a.splitNumRegx, a.getVersionDelimiter) : b
        }
    },
    cleanup: function() {
    },
    addWinEvent: function(d, c) {
        var e = this, a = window, b;
        if (e.isFunc(c)) {
            if (a.addEventListener) {
                a.addEventListener(d, c, false)
            }
            else {
                if (a.attachEvent) {
                    a.attachEvent("on" + d, c)
                }
                else {
                    b = a["on" + d];
                    a["on" + d] = e.winHandler(c, b)
                }
            }
        }
    },
    winHandler: function(d, c) {
        return function() {
            d();
            if (typeof c == "function") {
                c()
            }
        }
    },
    WLfuncs: [0],
    runWLfuncs: function(a) {
        a.winLoaded = true;
        a.callArray(a.WLfuncs);
        if (a.onDoneEmptyDiv) {
            a.onDoneEmptyDiv()
        }
    },
    winLoaded: false,
    $$onWindowLoaded: function(a) {
        return function(b) {
            if (a.winLoaded) {
                a.call(b)
            }
            else {
                a.fPush(b, a.WLfuncs)
            }
        }
    },
    div: null,
    divWidth: 50,
    pluginSize: 1,
    emptyDiv: function() {
        var c = this, a, e, b, d = 0;
        if (c.div && c.div.childNodes) {
            for (a = c.div.childNodes.length - 1; a >= 0; a--) {
                b = c.div.childNodes[a];
                if (b && b.childNodes) {
                    if (d == 0) {
                        for (e = b.childNodes.length - 1; e >= 0; e--) {
                            b.removeChild(b.childNodes[e])
                        }
                        c.div.removeChild(b)
                    }
                    else {
                    }
                }
            }
        }
    },
    onDoneEmptyDiv: function() {
        var a = this;
        if (!a.winLoaded) {
            return
        }
        if (a.WLfuncs && a.WLfuncs.length > 0 && a.isFunc(a.WLfuncs[a.WLfuncs.length - 1])) {
            return
        }
        if (a.java) {
            if (a.java.OTF == 3) {
                return
            }
            if (a.java.funcs && a.java.funcs.length > 0 && a.isFunc(a.java.funcs[a.java.funcs.length - 1])) {
                return
            }
        }
        a.emptyDiv()
    },
    getObject: function(c, a) {
        var g, d = this, f = null, b = d.getContainer(c);
        try {
            if (b && b.firstChild) {
                f = b.firstChild
            }
            if (a && f) {
                f.focus()
            }
        }
        catch (g) {
        }
        return f
    },
    getContainer: function(a) {
        return (a && a[0] ? a[0] : null)
    },
    instantiate: function(i, c, f, a, j) {
        var l, m = document, h = this, q, p = m.createElement("span"), o, g, n = "/";
        var k = function(s, r) {
            var u = s.style, d, t;
            if (!u) {
                return
            }
            u.outline = "none";
            u.border = "none";
            u.padding = "0px";
            u.margin = "0px";
            u.visibility = "visible";
            if (h.isArray(r)) {
                for (d = 0; d < r.length; d = d + 2) {
                    try {
                        u[r[d]] = r[d + 1]
                    }
                    catch (t) {
                    }
                }
                return
            }
        }, b = function() {
            var s, t = "pd33993399", r = null, d = (m.getElementsByTagName("body")[0] || m.body);
            if (!d) {
                try {
                    m.write('<div id="' + t + '">o<' + n + "div>");
                    r = m.getElementById(t)
                }
                catch (s) {
                }
            }
            d = (m.getElementsByTagName("body")[0] || m.body);
            if (d) {
                if (d.firstChild && h.isDefined(d.insertBefore)) {
                    d.insertBefore(h.div, d.firstChild)
                }
                else {
                    d.appendChild(h.div)
                }
                if (r) {
                    d.removeChild(r)
                }
            }
            else {
            }
        };
        if (!h.isDefined(a)) {
            a = ""
        }
        if (h.isString(i) && (/[^\s]/).test(i)) {
            q = "<" + i + ' width="' + h.pluginSize + '" height="' + h.pluginSize + '" ';
            for (o = 0; o < c.length; o = o + 2) {
                if (/[^\s]/.test(c[o + 1])) {
                    q += c[o] + '="' + c[o + 1] + '" '
                }
            }
            q += ">";
            for (o = 0; o < f.length; o = o + 2) {
                if (/[^\s]/.test(f[o + 1])) {
                    q += '<param name="' + f[o] + '" value="' + f[o + 1] + '" />'
                }
            }
            q += a + "<" + n + i + ">"
        }
        else {
            q = a
        }
        if (!h.div) {
            h.div = m.createElement("div");
            g = m.getElementById("plugindetect");
            if (g) {
                h.div = g
            }
            else {
                h.div.id = "plugindetect";
                b()
            }
            k(h.div, ["width", h.divWidth + "px", "height", (h.pluginSize + 3) + "px", "fontSize", (h.pluginSize + 3) + "px", "lineHeight", (h.pluginSize + 3) + "px", "verticalAlign", "baseline", "display", "block"]);
            if (!g) {
                k(h.div, ["position", "absolute", "right", "0px", "top", "0px"])
            }
        }
        if (h.div && h.div.parentNode) {
            h.div.appendChild(p);
            k(p, ["fontSize", (h.pluginSize + 3) + "px", "lineHeight", (h.pluginSize + 3) + "px", "verticalAlign", "baseline", "display", "inline"]);
            ;
            try {
                if (p && p.parentNode) {
                    p.focus()
                }
            }
            catch (l) {
            }
            try {
                p.innerHTML = q
            }
            catch (l) {
            }
            if (p.childNodes.length == 1 && !(h.isGecko && h.compareNums(h.GeckoRV, "1,5,0,0") < 0)) {
                k(p.firstChild, ["display", "inline"])
            }
            return [p]
        }
        return [null]
    },
    flash: {
        mimeType: ["application/x-shockwave-flash", "application/futuresplash"],
        progID: "ShockwaveFlash.ShockwaveFlash",
        classID: "clsid:D27CDB6E-AE6D-11CF-96B8-444553540000",
        getVersion: function() {
            var c = function(i) {
                if (!i) {
                    return null
                }
                var e = /[\d][\d\,\.\s]*[rRdD]{0,1}[\d\,]*/.exec(i);
                return e ? e[0].replace(/[rRdD\.]/g, ",").replace(/\s/g, "") : null
            };
            var j, g = this.$, h, f, b = null, a = null, d = null;
            if (!g.isIE) {
                j = g.findNavPlugin("Flash");
                if (j && j.description && g.hasMimeType(this.mimeType)) {
                    b = c(j.description)
                }
            }
            else {
                for (f = 15; f > 2; f--) {
                    a = g.getAXO(this.progID + "." + f);
                    if (a) {
                        d = f.toString();
                        break
                    }
                }
                if (d == "6") {
                    try {
                        a.AllowScriptAccess = "always"
                    }
                    catch (h) {
                        return "6,0,21,0"
                    }
                }
                try {
                    b = c(a.GetVariable("$version"))
                }
                catch (h) {
                }
                if (!b && d) {
                    b = d
                }
            }
            this.installed = b ? 1 : -1;
            this.version = g.formatNum(b);
            return true
        }
    },
    windowsmediaplayer: {
        mimeType: ["application/x-mplayer2", "application/asx"],
        progID: "wmplayer.ocx",
        classID: "clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6",
        getVersion: function() {
            var a = null, e = this.$, b = null;
            this.installed = -1;
            if (!e.isIE) {
                if (e.hasMimeType(this.mimeType)) {
                    if (e.findNavPlugin(["Windows", "Media", "(Plug-in|Plugin)"], false) || e.findNavPlugin(["Flip4Mac", "Windows", "Media"], false)) {
                        this.installed = 0
                    }
                    var d = e.isGecko && e.compareNums(e.GeckoRV, e.formatNum("1.8")) < 0;
                    if (!d && e.findNavPlugin(["Windows", "Media", "Firefox Plugin"], false)) {
                        var c = e.instantiate("object", ["type", this.mimeType[0]], [], "", this), f = e.getObject(c);
                        if (f) {
                            a = f.versionInfo
                        }
                    }
                }
            }
            else {
                b = e.getAXO(this.progID);
                if (b) {
                    a = b.versionInfo
                }
            }
            if (a) {
                this.installed = 1
            }
            this.version = e.formatNum(a)
        }
    },
    silverlight: {
        mimeType: "application/x-silverlight",
        progID: "AgControl.AgControl",
        digits: [9, 20, 9, 12, 31],
        getVersion: function() {
            var e = this.$, j = document, i = null, c = null, h = false, b = [1, 0, 1, 1, 1], r = [1, 0, 1, 1, 1], k = function(d) {
                return (d < 10 ? "0" : "") + d.toString()
            }, n = function(s, d, u, v, t) {
                return (s + "." + d + "." + u + k(v) + k(t) + ".0")
            }, o = function(d, s) {
                return q((d == 0 ? s : r[0]), (d == 1 ? s : r[1]), (d == 2 ? s : r[2]), (d == 3 ? s : r[3]), (d == 4 ? s : r[4]))
            }, q = function(t, s, w, v, u) {
                var u;
                try {
                    return c.IsVersionSupported(n(t, s, w, v, u))
                }
                catch (u) {
                }
                return false
            };
            if (!e.isIE) {
                var a = [null, null], f = e.findNavPlugin("Silverlight Plug-in", false), g = e.isGecko && e.compareNums(e.GeckoRV, e.formatNum("1.6")) <= 0;
                if (f && e.hasMimeType(this.mimeType)) {
                    i = e.formatNum(f.description);
                    if (i) {
                        r = i.split(e.splitNumRegx);
                        if (parseInt(r[2], 10) >= 30226 && parseInt(r[0], 10) < 2) {
                            r[0] = "2"
                        }
                        i = r.join(",")
                    }
                    if (e.isGecko && !g) {
                        h = true
                    }
                    if (!h && !g && i) {
                        a = e.instantiate("object", ["type", this.mimeType], [], "", this);
                        c = e.getObject(a);
                        if (c) {
                            if (q(b[0], b[1], b[2], b[3], b[4])) {
                                h = true
                            }
                            if (!h) {
                                c.data = "data:" + this.mimeType + ",";
                                if (q(b[0], b[1], b[2], b[3], b[4])) {
                                    h = true
                                }
                            }
                        }
                    }
                }
            }
            else {
                c = e.getAXO(this.progID);
                var m, l, p;
                if (c && q(b[0], b[1], b[2], b[3], b[4])) {
                    for (m = 0; m < this.digits.length; m++) {
                        p = r[m];
                        for (l = p + (m == 0 ? 0 : 1); l <= this.digits[m]; l++) {
                            if (o(m, l)) {
                                h = true;
                                r[m] = l
                            }
                            else {
                                break
                            }
                        }
                        if (!h) {
                            break
                        }
                    }
                    if (h) {
                        i = n(r[0], r[1], r[2], r[3], r[4])
                    }
                }
            }
            this.installed = h && i ? 1 : (i ? -0.2 : -1);
            this.version = e.formatNum(i)
        }
    },
    zz: 0
};

PluginDetect.initScript();
/************************************************************************/
/*									END									*/
/************************************************************************/
var mediaStock = {
    uploadPath: "",

    getImagePath: function(MediaStockImageID, MediaStockImageTypeID, MediaStockImageExt) {
        
        if (MediaStockImageID == "" || MediaStockImageID == null || MediaStockImageID == 0 || typeof (MediaStockImageID) == "undefined")
            return "";
        if (MediaStockImageTypeID != "" && MediaStockImageTypeID != null && MediaStockImageTypeID != 0) {
            return mediaStock.uploadPath + "/upload/mediastock/img/" + MediaStockImageTypeID + "/" + parseInt(MediaStockImageID / 1000000) + "/" + parseInt((MediaStockImageID % 1000000) / 1000) + "/" + MediaStockImageID + "." + MediaStockImageExt;
        }
        return mediaStock.uploadPath + "/upload/mediastock/NOREPLICATION/img/" + parseInt(MediaStockImageID / 1000000) + "/" + parseInt((MediaStockImageID % 1000000) / 1000) + "/" + MediaStockImageID + "_THUMBNAIL." + MediaStockImageExt;
    },

    getImageType: function(fileExtensionID) {
        fileExtensionID = parseInt(fileExtensionID);
        switch (fileExtensionID) {
            case 1:
                return "jpg";
            case 2:
                return "gif";
            case 3:
                return "jpeg";
            case 5:
            case 445:
                return "bmp";
            case 125:
                return "png";

            default:
                return "jpg";
        }
    }
};

}catch(e){}


//======== Array.js

try
{
/*
	This class will handle all array method
	Its extend the java script build-in Array object
	15/04/03 Guy Glass
*/
function CArray(oArr){
	onerror=function (sError,sURL,iLine){	return ClassException('CArray',sError,sURL,iLine); }
	// Add the methods address to the current class to be recognize outside the class scope
	oArr.Add=Add;
	this.Add=Add;
	oArr.Remove=Remove;
	this.Remove=Remove;
	oArr.IsExists=IsExists;
	this.IsExists=IsExists;
	oArr.isExists=IsExists;
	this.isExists=IsExists;
	this.length=getLength;
	oArr.isDuplicate=isDuplicate;
	this.isDuplicate=isDuplicate;

	function getLength()
	{
		return oArr.length;
	}
	
	function isDuplicate()
	{
		var arrTmp=new Array();
		for (var i=0;i<getLength();i++)
			if(arrTmp[oArr[i]])
			{
				return oArr[i];
			}
			else
				arrTmp[oArr[i]]=1;
		return null;
	}
	
	// Add object to the last array elements
	function Add(oValues){
		oArr[getLength()] = oValues;
		return oArr.length;
	}

	// Remove object from the array (Just place empty string insted of the object)	
	function Remove(oValues){
		var i;
		// The new array 
		var arrNewArray = new Array(oArr.length-1);

		for(i=0;i<oArr.length;i++){
			// check if the element is array
			if(oArr[i].length>0){
				if(oArr[i].join(",")==oValues){
					var tmp = new Array()
					oArr[i]=tmp;

					var j=0, nRemovedIndex=i;
					i=0;
					/*
					for(j=0;j<oArr[i].length;j++)
						oArr[i][j]='';
					*/
					/*
					for(j=0;j<oArr.length;j++){
						if(j!=nRemovedIndex)
							arrNewArray[j-i]=oArr[j];
						else
							i++;
					
					}
					*/
					// Replace between the two arrays
					/*
					oArr=null;
					oArr=new Array();
					for(j=0;j<arrNewArray.length;j++)
						oArr[j]=arrNewArray[j];
					*/
					return true;
				}
			}
			else{
				if(oArr[i]==oValues){
					oArr[i] = '';
					return true;
				}
			}
		}
		return false;			
	}	
	// Check if given object exists in the global array
	function IsExists(oValues){
	
		for(var i=0;i<oArr.length;i++)
		{
			if(oArr[i].join)
			{
				if(oArr[i].join(",")==oValues) return true;
			}
			else
			{
				if(oArr[i]==oValues) return true;
			}
		}
		return false;
	}
	
}

}catch(e){}


//======== Div.js

try
{
/*
	script take care of the arr of HTML object such as div,span and etc
	01/04/03 Shay Lapid
*/
function DivCollection(oArrDiv)
{
	this.onerror=function (sError,sURL,iLine){	return ClassException('DivCollection',sError,sURL,iLine); }
	this.Toogle=Toogle;
	oArrDiv.Toogle=Toogle;
	this.ToogleStyle=ToogleStyle;
	oArrDiv.ToogleStyle=ToogleStyle;
	this.ToogleHref=ToogleHref;
	oArrDiv.ToogleHref=ToogleHref;

	var iLen=oArrDiv.length;
	
	function Toogle(iPosition)
	{
	for (var i=0 ; i < iLen ; i++)
	{
		new Div(oArrDiv[i])
		oArrDiv[i].Close();
	}
	oArrDiv[iPosition-1].Open();
	location='#ContentBegin';
	}

	function ToogleStyle(iPosition,sChooseClass,sOtherClass)
	{
	for (var i=0 ; i < oArrDiv.length ; i++)
		oArrDiv[i].className=sOtherClass;
	oArrDiv[iPosition-1].className=sChooseClass;
	}
	function ToogleHref(iPosition,sDefaultHref)
	{
	for (var i=0 ; i < oArrDiv.length ; i++)
		oArrDiv[i].href=sDefaultHref + (i+1) + ');';
	oArrDiv[iPosition-1].removeAttribute('href',0);
	}

}

}catch(e){}


//======== DivCollection.js

try
{
/*
	script take care of the HTML object such as div,span and etc
	01/04/03 Shay Lapid
*/

function Div(Div1)
{
//this.onerror=function (sError,sURL,iLine){	return ClassException('Div',sError,sURL,iLine); }
var oIframePrint;
var oDiv=Div1;
var iStartPos;
var iStartPosLeft;
var iStartPosLeftWidth;
var bSameLocation;
var iSizeStep;
var iMaxSize;
var iStartHeight=0;
var iOpacityLevel;
var bNetScape = false;

try
{
	var bNetScape = navigator.appName.toLowerCase()=='netscape' ;
	iStartHeight=oDiv.nodeName=='IFRAME'?oDiv.height:iStartHeight=oDiv.offsetHeight;
}catch(e){}

this.getAllChild=getAllChild;
oDiv.getAllChild=getAllChild;
oDiv.iStartPos=iStartPos;
this.iStartPos=iStartPos;
oDiv.Print=Print;
this.Print=Print;
oDiv.ChangeState=ChangeState;
this.ChangeState=ChangeState;
oDiv.Open=StateOpen;
this.Open=StateOpen;
oDiv.Close=StateClose;
this.Close=StateClose;
oDiv.Clear=Clear;
this.Clear=Clear;
oDiv.reLocate=LocateInit;
this.reLocate=LocateInit;
oDiv.ChangeSize=ChangeSizeInit;
this.ChangeSize=ChangeSizeInit;
oDiv.ChangeSizeClose=ChangeSizeCloseInit;
this.ChangeSizeClose=ChangeSizeCloseInit;
oDiv.RemoveHTMLNode=RemoveNode;
this.RemoveHTMLNode=RemoveNode;
oDiv.ObjectResize=ObjectResize;
this.ObjectResize=ObjectResize;
oDiv.ObjectResizeHeight=ObjectResizeHeight;
this.ObjectResizeHeight=ObjectResizeHeight;
oDiv.ObjectResizeWidth=ObjectResizeWidth;
this.ObjectResizeWidth=ObjectResizeWidth;
oDiv.Opacity=Opacity;
this.Opacity=Opacity;
oDiv.FadeIn=FadeInInit;
this.FadeIn=FadeInInit;
oDiv.FadeOut=FadeOutInit;
this.FadeOut=FadeOutInit;
oDiv.ShowAndFade=ShowAndFade;
this.ShowAndFade=ShowAndFade;
oDiv.getWidth=getWidth;
this.getWidth=getWidth;
oDiv.getHeight=getHeight;
this.getHeight=getHeight;
oDiv.PositionBest=PositionBest;
this.PositionBest=PositionBest;
oDiv.LocationBest=LocationBest;
this.LocationBest=LocationBest;
oDiv.getElementX=getElementX;
this.getElementX=getElementX;
oDiv.getElementY=getElementY;
this.getElementY=getElementY;
oDiv.PlaceOver=PlaceOverInit;
this.PlaceOver=PlaceOverInit;
oDiv.isOpen=isOpen;
this.isOpen=isOpen;
	function getAllChildRecurse(sTag,oPtr,oArr)
	{
		for (var i=0;i<oPtr.length;i++)
		{
			if(sTag==oPtr[i].tagName)
				oArr[oArr.length]=oPtr[i];
			getAllChildRecurse(sTag,oPtr[i],oArr);
		}
	}
	function getAllChild(sTag)
	{
		var oArr=new Array();
		var oPtr=oDiv.parentNode.childNodes;
		getAllChildRecurse(sTag, oPtr,oArr);		
		return oArr;
	}
	function LocationBest(oInput)
	{
		var iTop=0;
		var iLeft=60;
		var oParent=oInput;

		for (var oPtr=oParent;oPtr;oPtr=oPtr.parentNode)
		{
			if(oPtr.tagName!='TR')
			{
				if( oPtr.offsetLeft )	iLeft += oPtr.offsetLeft;
				if( oPtr.offsetTop  )	iTop  += oPtr.offsetTop;
			}
		}
		oDiv.style.left=iLeft - oInput.getWidth()/2;
		oDiv.style.top=iTop + new Div(oParent).getHeight();
	}

	function getScreenWidth()
	{
		return document.body.offsetWidth;	
	}
	function PlaceOver(oDivToPlace,iTableWidth)
	{
		oDivToPlace.style.top=getElementY();
		var iX = getElementX();
		var iExtra = getScreenWidth() - iX >0 ? (getScreenWidth()-iTableWidth)/2 : 0 ;
		oDivToPlace.style.left = iX + iExtra;
		var fnResize=window.onresize;
	}

	function PlaceOverInit(oDivToPlace,iTableWidth)
	{
		PlaceOver(oDivToPlace,iTableWidth);
		var fnResize=window.onresize;
		window.onresize=function (){
			if (fnResize)
				fnResize();
			PlaceOver(oDivToPlace,iTableWidth);
		}
	}
	
	function getElementX()
	{	
		return oDiv.scrollLeft + oDiv.offsetLeft;
	}
	
	function getElementY()
	{	
		return oDiv.scrollTop + oDiv.offsetTop;
	}
	
	function PositionBest(e)
	{
			var x=getX(e);
			var y=getY(e);
			var iHeight=getHeight();
			var iWidth=getWidth();
			var iWidth2=iWidth / 2;
			var iPageWidth=getPageWidth() ;
			var iLeftScroll=document.body.scrollLeft;
			var	iLeftArrow=0;
			var oTDTop		= document.getElementById('tdToolTipTop');
			var oTDBottom	= document.getElementById('tdToolTipBottom');
			var iImgWidth	= 25
			if( y > document.body.scrollTop + iHeight )
			{
				y += -1 * iHeight - 20 
				if (oTDTop && oTDBottom)
				{
					new Div(oTDTop).Close()
					new Div(oTDBottom).Open()
				}
			}else{
				y += 20;
				if (oTDTop && oTDBottom)
				{
					new Div(oTDTop).Open()
					new Div(oTDBottom).Close()
				}
			}
			oDiv.style.top=y;
				
			if (bNetScape)
				oDiv.style.right=iPageWidth-x;
			else
			{
				if (x + iWidth2 > iPageWidth + iLeftScroll )
				{
					x= iPageWidth  - iWidth;
					iLeftArrow =  getX()-iLeftScroll- x - iImgWidth;
				}else if( x - iWidth2  < iLeftScroll)
				{
					x= 0; 
					
					iLeftArrow = getX()-iLeftScroll- x - iImgWidth;
				}else{
						x -= iLeftScroll + iWidth2 ;
						iLeftArrow=iWidth2 - iImgWidth;
				}
				
				if (iLeftArrow>0 && oTDTop && oTDBottom)
				{
					oTDTop.style.paddingLeft=iLeftArrow;
					oTDBottom.style.paddingLeft=iLeftArrow;
				}
				oDiv.style.left=x;
			}

	}
	
	function ShowAndFade(oDiv1)
	{
		StateOpen()
		oDiv1?oDiv1.onmouseout=FadeOutInit:oDiv.onmouseout=FadeOutInit;
	}
	
	function FadeInInit()
	{
		iOpacityLevel=0;
		FadeIn()
	}
	
	function FadeIn()
	{
		iOpacityLevel++;
		Opacity(iOpacityLevel);
		if (iOpacityLevel<=100)
			setTimeout(FadeIn,20);
	}

	function FadeOutInit()
	{
		iOpacityLevel=100;
		FadeOut()
	}

	function FadeOut()
	{
		iOpacityLevel-=5;
		Opacity(iOpacityLevel)
		if(iOpacityLevel>=0)
			setTimeout(FadeOut,20)
		else{
			StateClose(); 
			Opacity(100);
		}
		
	}

	function Opacity(iOpacity)
	{
		oDiv.style.filter='alpha(opacity=' + iOpacity + ', style=0)';
	}

	function getPageWidth()
	{
		return document.body.clientWidth;
	}
	
	function getPageHeight()
	{
		return document.body.clientHeight;
	}

	function getX(e)
	{
		var x;
		x=!bNetScape ? window.event.x :e.pageX;
		x+=document.body.scrollLeft;
		return x;
	}
	
	function getY(e)
	{
		return bNetScape ? e.pageY : window.event.y + document.body.scrollTop ;
	}

	function getWidth()
	{
	
	//alert(parseInt(document.defaultView.getComputedStyle(oDiv,'').getPropertyValue('width')));
		return oDiv.offsetWidth;
	}

	function getHeight()
	{
		return oDiv.offsetHeight;
	}

	function ObjectResizeHeight(oHTML)
	{
		oDiv.style.height	=oHTML.offsetHeight;
	}

	function ObjectResizeWidth(oHTML)
	{
		oDiv.style.width	=oHTML.offsetWidth;
	}

	function ObjectResize(oHTML,iOpacity)
	{
		ObjectResizeHeight(oHTML);
		ObjectResizeWidth(oHTML);

		if (iOpacity)
			Opacity(iOpacity);
	}
	
	function RemoveNode()
	{
		oDiv.parentNode.removeChild(oDiv);
	}

	function ChangeSizeInit(Step,MaxSize)
	{
		iSizeStep	= Step;
		iMaxSize	= MaxSize;
		clearInterval (oDiv.Interval);
		oDiv.Interval=setInterval(ChangeSize,10);
	}
	
	function Clear()
	{
		oDiv.innerHTML='';
	}
	
	function ChangeSize()
	{
		var iHeight=oDiv.offsetHeight;
		iHeight < iMaxSize?	oDiv.style.height = iHeight + iSizeStep : clearInterval (oDiv.Interval);
	}
	
	function ChangeSizeCloseInit(Step)
	{
		iSizeStep	= Step;
		clearInterval (oDiv.Interval);
		oDiv.Interval=setInterval(ChangeSizeClose,10);
	}

	function ChangeSizeClose()
	{
		var iHeight=oDiv.offsetHeight;
		iHeight > iStartHeight?	oDiv.style.height = iHeight - iSizeStep : clearInterval (oDiv.Interval);
	}
	
	function Print(sTitle)
	{
		var oArr=document.getElementsByTagName('link')
		if(!sTitle) sTitle='Print Frame';
		oIframePrint=document.createElement('<IFRAME id="ifrmPrint" src="about:blank" height="0" width="0">');
		var sHTML = 
		'<html dir=rtl>'+
			'<head>'+
				'<title>'+sTitle+'</title>';

		for (var i=0;i<oArr.length;i++)
			if(oArr[i].rel=='stylesheet')
				sHTML+=
				'<LINK REL="stylesheet" TYPE="text/css" HREF="' + oArr[i].href + '">';
		sHTML+=
			'</head>'+
			'<body>' + 
				oDiv.innerHTML+
			'<body>'+
		'</html>';
		
		document.body.appendChild(oIframePrint);
		var oIFr=document.frames['ifrmPrint']
		
		oIFr.document.writeln(sHTML);
		oIFr.focus();
		setTimeout(PrintFin,200);
	}
	
	function PrintFin()
	{
		print();
		document.body.removeChild(oIframePrint);
	}
	
	function StateOpen()
	{
		if (!isOpen())
		{
			if (bNetScape)
			{
				oDiv.style.display='inline';
			}
			oDiv.style.display='';
		}
	}
	
	function StateClose()
	{
		oDiv.style.display='none';
	}
	
	function isOpen()
	{
		return oDiv.style.display!='none';
	}
	
	function ChangeState()
	{
		isOpen() ? StateClose() : StateOpen();
	}
	
	function LocateInit(iY,bSamePlace)
	{
		!iY? iStartPos=oDiv.offsetTop : iStartPos=iY;
		var fnOnScroll=window.onscroll;
		window.onscroll=function (){
			if (fnOnScroll) fnOnScroll();
			reLocate();
		}
		bSameLocation=bSamePlace;
		iStartPosLeft=oDiv.offsetLeft;
		iStartPosLeftWidth	= oDiv.offsetWidth;
		reLocate ();
	}
	
	function reLocate()
	{
		var oDivStyle = oDiv.style
		var iDestPos
		if (bSameLocation)
			iDestPos = document.body.scrollTop + iStartPos;
		else if (iStartPos > document.body.scrollTop )
			iDestPos = iStartPos;
		else
			iDestPos = document.body.scrollTop;

		oDivStyle.left		= iStartPosLeftWidth + iStartPosLeft;
		oDivStyle.top		= iDestPos;
		
	}
		
	if (bNetScape)
	{
	/*
		oDiv.insertAdjacentHTML=function(stam,str)
		{	
			var r = document.createRange();
			r.setStartBefore(document.body);
			var oNode = r.createContextualFragment(str);
			
			if(stam=='afterBegin')
			{
				oDiv.insertBefore(oNode,oDiv.firstChild);
			}else{
				oDiv.appendChild(oNode);
			}
			

		}
	*/
		
		oDiv.insertAdjacentHTML = function (sWhere, sHTML) 
		 {
			
		 
			var oFragment;   
			var oRange = oDiv.ownerDocument.createRange();
			sWhere=String(sWhere).toLowerCase();

			switch (sWhere) 
			{  
				case "beforebegin":
					oRange.setStartBefore(oDiv);
					oFragment = oRange.createContextualFragment(sHTML);
					oDiv.parentNode.insertBefore(oFragment, oDiv);
					break;
				case "afterbegin":
					oRange.selectNodeContents(oDiv);
					oRange.collapse(true);
					oFragment = oRange.createContextualFragment(sHTML);
					oDiv.insertBefore(oFragment, oDiv.firstChild);
					break;
				case "beforeend":
					oRange.selectNodeContents(oDiv);
					oRange.collapse(false);
					oFragment = oRange.createContextualFragment(sHTML);
					oDiv.appendChild(oFragment);
					break;
				case "afterend":
					
					oRange.setStartAfter(oDiv);
					oFragment = oRange.createContextualFragment(sHTML);
					oDiv.parentNode.insertBefore(oFragment, oDiv.nextSibling);
					break;
				default:
					oDiv.appendChild(oNode);
					break;
			}
			
			
		}
		this.insertAdjacentHTML=oDiv.insertAdjacentHTML;
		
		oDiv.insertAdjacentElement = function(sWhere,oNode)
		{
			switch (sWhere)
			{
			case 'beforeBegin':
				oDiv.parentNode.insertBefore(oNode,oDiv)
				break;
			case 'afterBegin':
				oDiv.insertBefore(oNode,oDiv.firstChild);
				break;
			case 'beforeEnd':
				oDiv.appendChild(oNode);
				break;
			case 'afterEnd':
				if (this.nextSibling) 
					oDiv.parentNode.insertBefore(parsedNode,oDiv.nextSibling);
				else 
					oDiv.parentNode.appendChild(parsedNode);
				break;
			}
		}
		this.insertAdjacentElement=oDiv.insertAdjacentElement;
		
		function allIn(sID,oCurrNode)
		{
			for(var i=0;i<oCurrNode.length;i++)
			{
				if(oCurrNode[i].id==sID)
					return oCurrNode[i];
				else
				{
					var returned=allIn(sID,oCurrNode[i].childNodes);
					if (returned!=null)
						return returned;
				}
			}
		}

		function allFirst(sID)
		{
			var oCurrNode=oDiv.childNodes;
			return allIn(sID,oCurrNode);
		}
		
		this.all=allFirst;
		oDiv.all=allFirst;
		/*
		this.all=layer;
		oDiv.all=layer;
		*/

	}
}		

}catch(e){}


//======== Input.js

try
{
/*
	script take care of Input fields
	01/04/03 Shay Lapid
*/
function isNetScapeNavigator()
{
	return navigator.appName.toLowerCase()=='netscape' ;
}

function Input(oInput)
{
//onerror=function (sError,sURL,iLine){	return ClassException('Input',sError,sURL,iLine); }
var iMaxSize;
this.iMaxSize=iMaxSize;
oInput.iMaxSize=iMaxSize;
oInput.AddToPosition=AddToPosition;
this.AddToPosition=AddToPosition;

oInput.BlockHebChar=BlockHebChar;
this.BlockNonHebChar=BlockNonHebChar;
oInput.BlockNonHebChar=BlockNonHebChar;
this.BlockHebChar=BlockHebChar;
oInput.BlockNonEnglishChar=BlockNonEnglishChar;
this.BlockNonEnglishChar=BlockNonEnglishChar;
oInput.BlockNonNumericChar=BlockNonNumericChar;
this.BlockNonNumericChar=BlockNonNumericChar;
this.BlockNonFloatChar=BlockNonFloatChar;
oInput.BlockNonFloatChar=BlockNonFloatChar;	
oInput.BlockCR=BlockCR;
this.BlockCR=BlockCR;
oInput.BlockNonPriceChar=BlockNonPriceChar;
this.BlockNonPriceChar=BlockNonPriceChar;
this.BlockNonEnglishNumericChar=BlockNonEnglishNumericChar;
oInput.BlockNonEnglishNumericChar=BlockNonEnglishNumericChar;	

this.Sort = Sort;
oInput.Sort = Sort;
this.FixUrl=FixUrl;
oInput.FixUrl=FixUrl;	
this.CheckEmail=CheckEmail;
oInput.CheckEmail=CheckEmail;	
this.getContentSize=getContentSize;
oInput.getContentSize=getContentSize;	
this.MaxLength=MaxLength;
oInput.MaxLength=MaxLength;	
this.CheckLength=CheckLength;
oInput.CheckLength=CheckLength;	
this.getObjectIndex=getObjectIndex;
oInput.getObjectIndex=getObjectIndex;	
this.Rename=Rename;
oInput.Rename=Rename;	
this.getDoubleItem=getDoubleItem;
oInput.getDoubleItem=getDoubleItem;	
this.Replace=Replace;
oInput.Replace=Replace;	
this.isEmpty=isEmpty;
oInput.isEmpty=isEmpty;	
this.DisableIsValid=DisableIsValid;
oInput.DisableIsValid=DisableIsValid;	

	function DisableIsValid(oArrEnable,oArrDisable,sClassEnable,sClassDisable)
	{
		var bState = oInput.checked;

		for (var i=0;i<oArrEnable.length;i++)
		{
			oArrEnable[i].disabled=bState;
			oArrEnable[i].className=!bState?sClassEnable:sClassDisable;
		}

		for (var i=0;i<oArrDisable.length;i++)
		{
			oArrDisable[i].disabled=!bState;
			oArrDisable[i].className=bState?sClassEnable:sClassDisable;
		}						
	}


	function isEmpty()
	{
		for (var i=0;i<oInput.value.length;i++)
			if(oInput.value.charAt(i)!=' ')
				return false;
		return true;
	}
	function getDoubleItem()
	{
		var arrMyList = new Array() ;
		var counter ;
		for (counter = 0; counter < oInput.length-1 ; counter++)
			if (!arrMyList[oInput[counter].value])
				arrMyList[oInput[counter].value] = 1 ; 
			else
				return counter ;
		return null ;
	}

	function getObjectIndex(oArr)
	{
		var i=0;
		for (i=0;i<oArr.length;i++)
		{ 
			if (oInput==oArr[i])
				return i;
		}    
		return null;

	}

	function MaxLength(iMaxLength)
	{
		oInput.iMaxSize=iMaxLength-1;
		oInput.onkeypress=ConCat;
	}
	
	function ConCat()
	{
		if (oInput.iMaxSize<getContentSize())
		{
				oInput.innerText=oInput.innerText.substring(0,oInput.iMaxSize);
				//alert('less then' + (oInput.iMaxSize + 1) + ' chars')
		}
	}
	
	function CheckLength(iSize)
	{
		var arr=oInput.value.split(' ');
		
		for (i=0;i<arr.length;i++)
			if (arr[i].length>iSize)
				return false;
		return true;
	}	

	function Rename(sNewRadioName)
	{
		var oParent=oInput.parentNode;
		var oClone=document.createElement('<INPUT name="' + sNewRadioName + '">');
		oClone.type=oInput.type;
		oClone.onclick=oInput.onclick;
		oClone.value=oInput.value;
		var bChecked=oInput.checked;
		oParent.removeChild(oInput);
		oParent.appendChild(oClone);
		oClone.checked=bChecked;
	}

	function getContentSize()
	{
	return getContent().length;
	}
	
	function getContent()
	{
	if (!oInput.value)
		return oInput.innerText;
	else
		return oInput.value;
	}
	
	function CheckEmail()
	{
		return (oInput.value.indexOf("@")> 1 && oInput.value.lastIndexOf(".") > oInput.value.indexOf("@") + 2 );
	}

	function FixUrl()
	{
		if (oInput.value.indexOf("mailto:")!=-1 || oInput.value.indexOf("http://")!=-1) return ;
		if (oInput.value.indexOf("@")!=-1)
			oInput.value = "mailto:" + oInput.value
		else
			if (oInput.value.indexOf("www")!=-1)
				if (oInput.value.indexOf("http")==-1)
					oInput.value = "http://" + oInput.value
	}	
	
	function AddToPosition(sText)
	{
		oInput.focus();
		document.selection.createRange().text=sText;
	}
	
	function BlockCR(e) 
	{
		var PressedKey = getKeyCode(e);	
		
		if (PressedKey==13) 
			if (!isNetScapeNavigator()) window.event.returnValue = 0;
	}

	function BlockNonHebChar(e) 
	{
		var PressedKey = getKeyCode(e);			
		if (!((PressedKey>=1488) && (PressedKey<=1514)) || !PressedKey==39) 
			if (!isNetScapeNavigator()) window.event.returnValue = 0;
	}
	function BlockNonEnglishNumericChar(e) 
	{
		var PressedKey = getKeyCode(e);			
		if (!(
			(PressedKey>=97 && PressedKey<=122) || 
			(PressedKey>=48 && PressedKey<=57) || 
			(PressedKey==45 ) || 
			(PressedKey==95) || 
			(PressedKey>=65 && PressedKey<=90)) 
			)
			if (!isNetScapeNavigator()) window.event.returnValue = 0;
	}
	function BlockHebChar(e) 
	{
		var PressedKey = getKeyCode(e);		
		if ((PressedKey>=1488) && (PressedKey<=1514) ) 
			if (!isNetScapeNavigator()) window.event.returnValue = 0;

	}
	function getKeyCode(e)
	{
		return isNetScapeNavigator()?  e.which : window.event.keyCode;
	}
	function BlockNonNumericChar(e) 
	{
		var PressedKey = getKeyCode(e);		
		if (!(PressedKey>=48 && PressedKey<=57))
			if (!isNetScapeNavigator())  window.event.returnValue = 0;
	}
	function BlockNonFloatChar(e) 
	{
		var PressedKey = getKeyCode(e);		
		if (!(PressedKey>=46 && PressedKey<=57))
			if (!isNetScapeNavigator())  window.event.returnValue = 0;
	}
	function BlockNonPriceChar(e) 
	{
		var PressedKey = getKeyCode(e);		
		if (!(
			   (PressedKey>=48 && PressedKey<=57) || 
			    PressedKey==46)
			  )
			if (!isNetScapeNavigator())  window.event.returnValue = 0;
	}
	
	function BlockNonEnglishChar(e) 
	{
		var PressedKey = getKeyCode(e);						
		if (!(
			(PressedKey>=97 && PressedKey<=122) || 
			(PressedKey>=65 && PressedKey<=90)) 
			)
			if (!isNetScapeNavigator()) window.event.returnValue = 0;
	}
	
	function Replace(sBefore,sAfter)
	{
		var oRE			= new RegExp(sBefore,'g');
		oInput.value	= oInput.value.replace(oRE,sAfter);
	}
	
	function Sort(ArrInput, IsCaseSensitive)
	{
		var arrSort = new Array(ArrInput.length);
		var sInput
		for (i = 0; i < arrSort.length; ++i)
		{
			sInput = ArrInput[i].value
			if (IsCaseSensitive)
				arrSort[i] = sInput;
			else
				arrSort[i] = sInput.toLowerCase();

		}

		arrSort = arrSort.sort();

		var index = 0;
		for (i = 0; i < arrSort.length; ++i)
			for (j = 0; j < arrSort.length; ++j)
			{
				sInput = ArrInput[j].value;
				if (!IsCaseSensitive)
					sInput = sInput.toLowerCase();
				if (arrSort[i] == sInput)
					oInput[j].value = ++index;
			}
	}	
	
}

function ChangeSecurityQuestion(type)
				{
					switch(type)
					{
						case 'nanaList':						
							document.getElementById('containerNanaSecurityQuestion').style.display = '';
							document.getElementById('containerUserSecurityQuestion').style.display = 'none';
							document.getElementById('SecurityQuestionType').value = 1;
							break;
						case 'userQ':						
							document.getElementById('containerNanaSecurityQuestion').style.display = 'none';
							document.getElementById('containerUserSecurityQuestion').style.display = '';
							document.getElementById('SecurityQuestionType').value = 2;
							break;
					}
				}
				
				function CheckUserName(name)
				{		
				    					
					switch(name)
					{
						case 'UserName':
							if(document.getElementById('UserName').value=='')
							{
								alert('   ')
								return;
							}
							document.getElementById('ifrAlternateUserNames').src='Form.asp?s=100&pid=48&UserName='+document.getElementById('UserName').value;	
							document.getElementById("takenNick").style.display="inline-block";
							break;
						case 'NickName':
							if(document.getElementById('NickName').value=='')
							{
								alert('  ')
								return;
							}
							
							document.getElementById('ifrAlternateUserNames').src='Form.asp?s=101&pid=48&UserName='+document.getElementById('NickName').value;	
							break;
						case 'ChatName':
							if(document.getElementById('ChatName').value=='')
							{
								alert('  ')
								return;
							}
							
							document.getElementById('ifrAlternateUserNames').src='Form.asp?s=101&pid=48&UserName='+document.getElementById('ChatName').value;	
							break;	
					}					
				}	
				

function RevealUserOptions()
{
	var nome = document.getElementById("userOptions");
	
	if (nome.style.display=="block")
	{	
		document.getElementById("userOptions").style.display="none";
	}
	else
	nome.style.display="block";
}	
				
				
				
	function fCheckFields()
		{																
			var sError = '';
			var oInput=new Input(document.S2.Email);												 
			if((document.S2.Password.value.length) < 6)
			{
				sError='*    6   .<br/>'
			}
			
			if (oInput.CheckEmail()!=true && document.S2.Email.value!=''){sError= sError + '*   .<br/>'}
			if(document.S2.UserName.value==''){sError= sError + '*   .<br/>'}
			if(!document.S2.chbTermsOfUse.checked){sError= sError + '*     .<br/>'}						
			if(sError!='')
			{
				alert("    ")
				sError='<b>    :</b><br/>' + sError ;
				return false;
			}
			
		}
		
			function TwistNShow()
				{
					var takanon = document.getElementById('rulesOfUsage');
					var secBlock = document.getElementById('securityBlock');
					var isCheckBox = document.getElementById('chbTermsOfUse');
					
					if (takanon.style.display == 'block' && isCheckBox.checked==true)
					{
						takanon.style.display = 'none';
						secBlock.style.display = 'block';
					}

				}
				
			function ShowTakanon()
			{
				var takanon = document.getElementById('rulesOfUsage');
				var secBlock = document.getElementById('securityBlock');
				
				if (takanon.style.display == 'none')
				{
						takanon.style.display = 'block';
						secBlock.style.display = 'none';
				}
				else
					takanon.style.display = 'none';
			}
			
			function RevealPass()
			{
				var passBox = document.getElementById('newUserPass');
				passBox.setAttribute('type','text');
				
			}
				
}catch(e){}


//======== InputCollection.js

try
{
/*
	script take care of Array Input fields
	01/04/03 Shay Lapid
*/
function InputCollection(oArr)
{
//onerror=function (sError,sURL,iLine){	return ClassException('InputCollection',sError,sURL,iLine); }
oArr.Replace=Replace;
this.Replace=Replace;
oArr.isRadioChecked=isRadioChecked;
this.isRadioChecked=isRadioChecked;
oArr.Toggle=Toggle;
this.Toggle=Toggle;
	function Replace(sBefore,sAfter)
	{
		for (var i=0;i<oArr.length;i++)
			new Input(oArr[i]).Replace(sBefore,sAfter);
	}
	
	function isRadioChecked()
	{
		for(var i=0;i<oArr.length;i++)
			if(oArr[i].checked)
				return true;
		return false;
	}
	function Toggle()
	{
		for(var i=0;i<oArr.length;i++)
			oArr[i].checked=!oArr[i].checked;
	}
	
}
}catch(e){}


//======== AutoComplete.js

try
{

function AutoComplete ( oInput,sWebserviceURLBase ,iSize,sDefaultValue,iDefaultID){ 
	var oArrGlobal=new Array();
	var oDivAbs;
	var oSelect;
	var bSafe=true;
	var sParam='';
	new Div(oInput)
	this.AddElements=AddElements;
	this.getValue=getValue;
	this.setValue=setSelectInit;
	this.setParam=setParam;
	oInput.onkeyup=keyAction;
	if (!iSize) iSize=3;
	Init();
	
	function getParam4Arr(){ return 'Param' + sParam;}
	function setParam(sValue){		sParam=sValue; }
	function getName(sPrefix){		return sPrefix + '_' + oInput.name;	}
	function getLetter(){			return oInput.value.substring(0,1);	}
	function getId(sPrefix)	{		return sPrefix + '_' + oInput.id	}
	function getKeyCode(e){			return isNetScapeNavigator()?  e.which : window.event.keyCode;	}
	function selectChanged (e){		oInput.value=oSelect[oSelect.selectedIndex].text;	}
	function getValue(){			return oSelect.value==''?-1:oSelect.value;		}
	
	function Init( ){
		oDivAbs=document.getElementById(getId('div'));
		
		if (oDivAbs) 
		{
			new Div( oDivAbs ).RemoveNode(); 
		}
		var sHTML=
			'<div id="' + getId('div') + '" style="display:none;Position:absolute;padding-Right:5px;">'+
				'<iframe name="' + getName('iframe') + '" id="' + getId('iframe') + '" height="0" width="0" marginwidth="0" marginheight="0" hspace="0" vspace="0" scrolling="no" frameborder="0"></iframe>'+
				'<select z-index=900 name="' + getName('sel') + '" id="' + getId('sel') + '" size="' + iSize + '">'+
				'</select>' +
			'</div>'

		var oAddDiv=oInput.parentNode;
		new Div(oAddDiv)

		oAddDiv.insertAdjacentHTML("beforeEnd", sHTML)
		oDivAbs=document.getElementById(getId('div'));
		new Div(oDivAbs)
		oDivAbs.Close();
		oSelect=document.getElementById(getName('sel'));
		
		oSelect.onchange=selectChanged;
		oSelect.onclick=function()
		{
			oDivAbs.Close();
			bSafe=false;
		}
		
		oInput.onblur=function()
		{
			if (oSelect.length>0)
			{
				if (bSafe)
				{
					if (oSelect.selectedIndex==-1 && oSelect.length>0)
						oSelect.selectedIndex=0; 
					oDivAbs.Close(); 
				}
				bSafe=true;
				selectChanged();
			}
		}
		
		if (sDefaultValue)
		{
			setSelectInit(sDefaultValue,iDefaultID);
		}
	}
	function setSelectInit(sText,iId)
	{
		oSelect.length=0;
		oInput.value = sText;
		var iIdx=++oSelect.length-1;
		oSelect.options[iIdx].text=sText;
		oSelect.options[iIdx].value=iId;
		oSelect.selectedIndex=iIdx;
	}
	function setLocation()
	{
		var sLetter=getLetter();
		frames[getName('iframe')].location = sWebserviceURLBase + sLetter + '&' + sParam;
	}
	function selectChange(iAdd)
	{
		if (oSelect.length<=0) return;
		
		if (iAdd>0 )
			oSelect.selectedIndex+=oSelect.selectedIndex + iAdd > oSelect.length-1 ? 0 : iAdd;
		else
			oSelect.selectedIndex + iAdd < 0 ? oSelect.selectedIndex=oSelect.length-1 : oSelect.selectedIndex+=iAdd;
		
		selectChanged ();
	}
	function keyAction(e)
	{
		var sLetter=getLetter();
		if (sLetter=='' ||sLetter==' ') 
		{
			oSelect.length=0;
			oDivAbs.Close();
			return;
		}
		var sKeyCode=getKeyCode(e);
		if (getKeyCode(e)==13) 
		{
			oDivAbs.Close();
			if (oSelect.selectedIndex==-1)oSelect.selectedIndex=0;
			selectChanged();
		}
		else if (sKeyCode==40 || sKeyCode==37) 
			selectChange(+1);
		else if (sKeyCode==38 || sKeyCode==39) 
			selectChange(-1);
		else if ((!oArrGlobal[getLetter()]||!oArrGlobal[getLetter()][getParam4Arr()]) && sWebserviceURLBase)
		{
			setLocation();
		}else
			fillSelect();
	}
	function fillSelect()
	{
		var oArrLocal=oArrGlobal[getLetter()][getParam4Arr()];
		var iIdx=0;
		oSelect.length=0;
		for (var i=0;i<oArrLocal.length;i++)
			if (oArrLocal[i]['Name'].indexOf(oInput.value)>=0)
			{
				iIdx=++oSelect.length-1;
				oSelect.options[iIdx].text=oArrLocal[i]['Name'];
				oSelect.options[iIdx].value=oArrLocal[i]['Value'];
			}

		oSelect.length>0?oDivAbs.Open():oDivAbs.Close();
		
		oDivAbs.LocationBest(oInput);				
	}
	function AddElements(oArrSrc)
	{
		if (!oArrSrc.length ) 
		{
			var sLetter=getLetter();
			oArrGlobal[sLetter]=new Array();
			oArrGlobal[sLetter][getParam4Arr()]=new Array();;
			oDivAbs.Close();
			
			return;
		}
		var sKey=oArrSrc[0]['Name'].substring(0,1);
		oArrGlobal[sKey] = new Array();
		oArrGlobal[sKey][getParam4Arr()] = oArrSrc;
		fillSelect();
	}
}

}catch(e){}


//======== Exception.js

try
{
/*
	script take care of exception (use in development only)
	01/04/03 Shay Lapid
*/
function DiplayException(sMsg)
{
	sEnvironment!=''?alert(sMsg):status=sMsg;
}
function getExceptionDelimiter()
{
	return sEnvironment!=''?'\n':'; ';
}
function ClassException(sClassName , sDescription , sURL , iLine)
{
	var sDelimiter	= getExceptionDelimiter();
	var sError		=	'Class:'+ sClassName + sDelimiter +
						'Err:' + sDescription + sDelimiter +
						'Line:' + iLine ;
	DiplayException(sError);
	return true;
}

function NanaException(sErrorMessage,sUrl,iLine) 
{
	var sDelimiter	= getExceptionDelimiter();
	var sError=
		'Err: ' + sErrorMessage  + sDelimiter +
		'Url : ' + sUrl + sDelimiter +
		'Line: ' + iLine ;
	DiplayException(sError);

return true;	
}
onerror = NanaException;


}catch(e){}


//======== ClickReport.js

try
{
var naSTATISTICS_COLLECT_URL = "http://nsc" + sEnvironment + ".nana10.co.il/update.php?";

function ClickReport(sObjectName,sInstanceID,sSecInstanceID,iLocationID,Optional1,Optional2,Optional3)
{
	var oDate		= new Date();
	var sFullURL	= naSTATISTICS_COLLECT_URL + 'ObjectName=' + sObjectName + '&InstanceID=' + sInstanceID;
	var bStatsReported = false;
	
	try
	{
		if (PartnerID) sFullURL+='&PartnerID=' + PartnerID;		
	}catch(e){}
	
	try
	{		
		if (ServiceID) sFullURL += '&ServiceID=' + ServiceID;
	}
	catch(e){}
	
	if (typeof(iLocationID) != "undefined" && iLocationID != null) sFullURL += '&LocationID=' + iLocationID;
	if (typeof(sSecInstanceID) != "undefined" && sSecInstanceID != null) sFullURL += '&SecInstanceID=' + sSecInstanceID;
	if (typeof(Optional1) != "undefined" && Optional1 != null) sFullURL += '&Optional1=' + Optional1;
	if (typeof(Optional2) != "undefined" && Optional2 != null) sFullURL += '&Optional2=' + Optional2;
	if (typeof(Optional3) != "undefined" && Optional3 != null) sFullURL += '&Optional3=' + Optional3;

	sFullURL += '&d=' + oDate.toString();
	
	var oImage = new Image();
	oImage.src = sFullURL;
	
	return true;
}

function cr(oEvent,sObjectName,sInstanceID,sSecInstanceID,iLocationID,Optional1,Optional2,Optional3){
	
	// if we are on category page then report click position on the grid
	if (oEvent && $("#CategoryGrid").length == 1){
		ReportGridClick(oEvent);
	}
	
	return ClickReport(sObjectName,sInstanceID,sSecInstanceID,iLocationID,Optional1,Optional2,Optional3);
}

function ReportGridClick(oEvent) {
    var oScrollOffsets = 0;
    if (typeof (getScrollXY) != "undefined") {
        oScrollOffsets = getScrollXY();
    }
	var oGridOffset = $("#CategoryGrid").offset();
	var nRow,nColumn;
	var sFullURL = naSTATISTICS_COLLECT_URL + "ObjectName=ClickCategoryGrid";

	var nTop = parseInt(oEvent.clientY + oScrollOffsets[1]) - oGridOffset.top;
	var nLeft = parseInt(oEvent.clientX + oScrollOffsets[0]) - oGridOffset.left;
	
	if (nLeft >= 0 && nTop >= 0){
		nRow = Math.ceil(nTop / 80);
		nColumn = Math.ceil(nLeft / 80);
		
		sFullURL += "&InstanceID=" + CategoryID + "&RowNum=" + nRow + "&ColNum=" + nColumn + "&d=" + Math.random();
		
		var oImage = new Image();
		oImage.src = sFullURL;	
	}
}

/************************************************************************************************************/
/* ******************************** PERSONALIZATION RELATED FUNCTIONS ************************************* */
/************************************************************************************************************/

function naUUProcess(bFirstTry){
	var PEnabledCookieName = "naFPPE";
	
	if (IsCookiesEnabled() != true || (window != window.top && typeof EnableStandaloneReport == "undefined")) {return;}
	
	var GuidToReport = getPersonalizationGUID();
	var PageNum = RequestQueryString("pagenum",document.location.href.toLowerCase());
	PageNum = PageNum == "" ? 0 : PageNum;
	
	if (GuidToReport && (new Cookie(PEnabledCookieName)).getCookie() != "0"){
		naUUReport(GuidToReport,ServiceID,sClassName,PageNum,nInstanceID,nContentRealmID);
		if (bFirstTry !== false){
			document.write("<script type=\"text\/javascript\" src=\"http://common" + sEnvironment + ".nana10.co.il/GH/getPersonalizationData.ashx?_rnd=" + (new Date()).valueOf() + "\"><\/script>");
		}
	}
	else if (typeof bFirstTry === "undefined" || bFirstTry === true){
		$.getJSON("http://common" + sEnvironment + ".nana10.co.il/GH/getUniqueUserGUID.ashx?callback=?", {}, function(){naUUProcess(false);});
	}
}

function naUUReport(GuidToReport,ServiceID,ClassName,PageNum,InstanceID,ContentRealmID){
	var sReportURL = naSTATISTICS_COLLECT_URL;
	
	if (parseInt(ContentRealmID,10) == 0){
		return;
	}
	
	sReportURL += "ObjectName=UniqueUserVisit";
	sReportURL += "&UserGUID=" + GuidToReport;
	sReportURL += "&ServiceID=" + ServiceID;
	sReportURL += "&ClassName=" + ClassName;
	sReportURL += "&PageNum=" + PageNum;
	sReportURL += "&InstanceID=" + InstanceID;
	sReportURL += "&IsLoggedIn=" + ((new Cookie("ClubGuidID")).getCookie()?"1":"0");
	sReportURL += "&ContentRealm=" + ContentRealmID;
	
	var oImage = new Image();
	oImage.src = sReportURL + "&Date=" + escape(new Date());
	delete oImage;
	oImage = null;
}

function getPersonalizationGUID(){
	var oUUCookie = (new Cookie("naUUID")).getCookie();
	var oClubCookie = (new Cookie("ClubGuidID")).getCookie();
	return (oClubCookie && oClubCookie != "") ? oClubCookie.replace(/[{}]/gi,"").toLowerCase() : oUUCookie;
}

function IsCookiesEnabled(){
	try {
		result = false;
		var oCookie = (new Cookie("test"));
		oCookie.setCookie("1",null,"nana10.co.il");
		if (oCookie.getCookie() == "1"){
			result = true;
		}
		oCookie.setCookie("0",-1,"nana10.co.il");
		return result;
	}
	catch(ex){
		return false;
	}
}

}catch(e){}


//======== Cookies.js

try
{

function Cookie(sCookieName)
{
	//onerror=function (sError,sURL,iLine){	return ClassException('Cookie',sError,sURL,iLine); }
	// This function save cookie
	this.setCookie=setCookie;
	this.getCookie=getCookie;
	this.sCookieName=sCookieName;
	
	function setCookie(sValue,iMinutes,sDomain) {
		if (iMinutes) {
			var date = new Date();
			date.setTime(date.getTime()+(iMinutes*60*1000))
			var expires = "; expires="+date.toGMTString()
		} else expires = ""
		var sCookieCont=sCookieName+"="+sValue+expires+"; path=/"
		sCookieCont += sDomain!="" && sDomain ?	" ; domain="+sDomain : " ; domain="+location.host;
		document.cookie = sCookieCont
	}
	// This function read the cookie that was saved by saveCookie function
	function getCookie() {
		var nameEQ = sCookieName + "="
		var ca = unescape( document.cookie).split(';')
		var sCookie
		for(var i=0;i<ca.length;i++) 
		{
			sCookie = ca[i];
			while (sCookie.charAt(0)==' ') sCookie = sCookie.substring(1,sCookie.length)
				if (sCookie.indexOf(nameEQ) == 0) return sCookie.substring(nameEQ.length,sCookie.length)
		}
	}
}
}catch(e){}


//======== ToolTip.js

try
{
/*
	script take care of the tooltip object open the div and design it
	20/04/03 Shay Lapid
*/
var oToolTipLastAccess
var arrToolTip=new Array();

function ToolTipDisplay(oHref,iType,sTitle,sSubTitle)
{
	var oInterVal;	
	if(!arrToolTip[iType])
	{
		var sToolTipName='divToolTip' + iType;
		arrToolTip[iType]=new Array();
		arrToolTip[iType]['ToolTip']=document.getElementById(sToolTipName);
		new Div(arrToolTip[iType]['ToolTip']);
		arrToolTip[iType]['Title']=arrToolTip[iType]['ToolTip'].all('Title');
		arrToolTip[iType]['SubTitle']=arrToolTip[iType]['ToolTip'].all('SubTitle');
	}

	if ( arrToolTip[iType]['ToolTip']  )
	{
		arrToolTip[iType]['ToolTip'].Open();
		if (oToolTipLastAccess != oHref)
		{
			arrToolTip[iType]['Title'].innerHTML=sTitle;
			arrToolTip[iType]['SubTitle'].innerHTML=sSubTitle;
			oHref.onmousemove	= function (e)
			{
				arrToolTip[iType]['ToolTip'].PositionBest(e);
				/*
				clearTimeout(this.oInterVal);
				this.oInterVal=setTimeout(arrToolTip[iType]['ToolTip'].FadeOut,15000);
				*/
			}
			oHref.onmouseout	= function (){arrToolTip[iType]['ToolTip'].Close();}
			oToolTipLastAccess=oHref
		}
	}
	
}



}catch(e){}

