var im_gui={

version: '2.3.3',browser: {ie: (navigator.appName == 'Microsoft Internet Explorer'),
ie6: /msie 6/i.test(navigator.userAgent),
ie7: /msie 7/i.test(navigator.userAgent),
ff: /firefox/i.test(navigator.userAgent),
java: navigator.javaEnabled(),
ns: (navigator.appName == 'Netscape'),
userAgent: navigator.userAgent.toLowerCase(),
version: parseFloat(navigator.appVersion.substr(21)) || parseFloat(navigator.appVersion)
},

window: {

_dlgWin: null,

newWindow: function(mypage,myname,w,h,scroll){
if (typeof scroll == 'undefined') scroll='auto';
var POS=this.getCenterizedScreen(w,h);
settings='width='+w+',height='+h+',top='+POS.y+',left='+POS.x+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
if (this._dlgWin){ this._dlgWin.close(); }
this._dlgWin=window.open(mypage,myname,settings);
},

getWindowInnerDim: function(){
if (self.innerHeight){ 

return {'width': self.innerWidth, 'height': self.innerHeight};
}else if (document.documentElement && document.documentElement.clientHeight){

return {'width': document.documentElement.clientWidth, 'height': document.documentElement.clientHeight};
}else if (document.body){ 

return {'width': document.body.clientWidth, 'height': document.body.clientHeight};
}
},

getCenterizedPos: function(elemWidth, elemHieght){
var pageScroll=this.getPageScroll();
var centerX=(screen.availWidth/2-elemWidth/2)+pageScroll.x;
var centerY=(screen.availHeight/2-elemHieght/2)+pageScroll.y-80;
return {'x': centerX, 'y': centerY};
},

getCenterizedScreen: function(elemWidth, elemHieght){
var pageScroll=this.getPageScroll();
var centerX=(screen.width/2-elemWidth/2);
var centerY=(screen.height/2-elemHieght/2);
return {'x': centerX, 'y': centerY};
},

getPageScroll: function(){
var pageX=pageY=0;
if (self.pageYOffset){ 

pageX=self.pageXOffset;
pageY=self.pageYOffset;
}else if (document.documentElement && document.documentElement.scrollTop){

pageX=document.documentElement.scrollLeft;
pageY=document.documentElement.scrollTop;
}else if (document.body){

pageX=document.body.scrollLeft;
pageY=document.body.scrollTop;
}
return {'x': pageX, 'y': pageY};
}
},

getBodyDim: function(){
return {
offsetWidth: (/msie/i.test(navigator.userAgent) ? document.body.scrollWidth : window.innerWidth+window.scrollMaxX),
offsetHeight: (/msie/i.test(navigator.userAgent) ? document.body.scrollHeight : window.innerHeight+window.scrollMaxY)
};
},

obj: function(id,type,parent){
return this.misc.obj(id,type,parent);
},

misc: {

obj: function(id,type,parent){
if(type=="tag"){
if(parent && parent.getElementsByTagName(id)){
return parent.getElementsByTagName(id);
}
}else if(type=="name"){
if(document.getElementsByName(id)){
return document.getElementsByName(id)[0];
}
}else{
if(document.getElementById(id)){
return document.getElementById(id);
}
}
return (false);
},

innerData: function(id, data, addingPos){
if(typeof(id)=='object'){
if(typeof(addingPos)=='undefined' || !addingPos){
id.innerHTML=data;
}else if(addingPos=='begin' || addingPos=='before'){
id.innerHTML=data + id.innerHTML;
}else if(addingPos=='end' || addingPos=='after'){
id.innerHTML += data;
}
}else{
if(typeof(addingPos)=='undefined' || !addingPos){
this.obj(id).innerHTML=data;
}else if(addingPos=='begin' || addingPos=='before'){
this.obj(id).innerHTML=data + this.obj(id).innerHTML;
}else if(addingPos=='end' || addingPos=='after'){
this.obj(id).innerHTML += data;
}
}
},

gotoURL: function(url){
document.location.href=url;
},

findPosX: function(obj){
var curleft=0;
if (obj.offsetParent){
while (obj.offsetParent){
curleft += obj.offsetLeft;
obj=obj.offsetParent;
}
}else{
if (obj.x) curleft += obj.x;
}
return curleft;
},

findPosY: function(obj){
var curtop=0;
if (obj.offsetParent){
while (obj.offsetParent){
curtop += obj.offsetTop;
obj=obj.offsetParent;
}
}else{
if (obj.y) curtop += obj.y;
}
return curtop;
},

toInt: function(val){
if (val=='' || val==null || val==NaN) val=0;
return (parseInt(val));
},

setSize: function(base,inc){
return ((this.toInt(base)+inc)+'px');
},

textSelection: function(nodeObj, isAvailable){
nodeObj=(typeof(nodeObj)=='string' ? im_gui.misc.obj(nodeObj) : nodeObj);
if (im_gui.browser.ie){
nodeObj.setAttribute('isTextSelectionAvailable', isAvailable);
nodeObj.onselectstart=function(){return this.getAttribute('isTextSelectionAvailable');};
}else if(im_gui.browser.ff){

nodeObj.style.MozUserSelect=(isAvailable ? "" : "none");
}else{
nodeObj.setAttribute('isTextSelectionAvailable', isAvailable);
nodeObj.onmousedown=function(){return this.getAttribute('isTextSelectionAvailable');};
}
},

appendAfter: function(refChild, newChild) { 
refChild.parentNode.insertBefore(newChild,refChild.nextSibling); 
} 
},

display: {

setOpacity: function(obj,intOpacity){
if(typeof(obj)=='string'){obj=im_gui.misc.obj(obj);}
if(typeof(obj)!='object'){return false;}
if (im_gui.browser.ie){
if(typeof(obj)=='object'){
obj.style.filter="alpha(opacity="+intOpacity+")";
}else{
im_gui.misc.obj(obj).style.filter="alpha(opacity="+intOpacity+")";
}
}else{
if(typeof(obj)=='object'){
obj.style.opacity=intOpacity/100;
}else{
im_gui.misc.obj(obj).style.opacity=intOpacity/100;
}
}
},

getObjOpacity: function(obj){
if(typeof(obj)=='string'){obj=im_gui.misc.obj(obj);}
if(typeof(obj)!='object'){return false;}
var opc;
if(im_gui.browser.ie){
if(typeof(obj)=='object'){
if (obj && obj.filters && obj.filters.alpha && obj.filters.alpha.opacity){
opc=obj.filters.alpha.opacity;
}else{
this.setOpacity(obj,100);
opc=100;
}
}else{
if (im_gui.misc.obj(obj) && im_gui.misc.obj(obj).filters && im_gui.misc.obj(obj).filters.alpha && im_gui.misc.obj(obj).filters.alpha.opacity){
opc=im_gui.misc.obj(obj).filters.alpha.opacity;
}else{
this.setOpacity(im_gui.misc.obj(obj),100);
opc=100;
}
}
}else{
if(typeof(obj)=='object'){
opc=obj.style.opacity*100;
}else{
opc=im_gui.misc.obj(obj).style.opacity*100;
}
}
if (opc==''){
if(typeof(obj)=='object'){
this.setOpacity(obj,100);
}else{
this.setOpacity(im_gui.misc.obj(obj),100);
}
opc=100;
}
return (opc);
},

hideDLLObjs: function(){
var elems=im_gui.obj("object","tag",document);
for(var i=0; i<elems.length;i++){
if(
(
elems[i].getAttribute("classid")!=null && 
elems[i].getAttribute("classid").toUpperCase()=="CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000"
) || (
elems[i].getAttribute("type")!=null && 
elems[i].getAttribute("type")=="application/x-shockwave-flash"
)
){
elems[i].style.visibility="hidden";
}
}
if(document.all){
elems=im_gui.obj("select","tag",document);
for(var i=0; i<elems.length;i++){
elems[i].style.visibility="hidden";
}
}
},

showDLLObjs: function(){
var elems=im_gui.obj("object","tag",document);
for(var i=0; i<elems.length;i++){
if(
(
elems[i].getAttribute("classid")!=null && 
elems[i].getAttribute("classid").toUpperCase()=="CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000"
) || (
elems[i].getAttribute("type")!=null && 
elems[i].getAttribute("type")=="application/x-shockwave-flash"
)
){
elems[i].style.visibility="visible";
}
}
if(document.all){
elems=im_gui.obj("select","tag",document);
for(var i=0; i<elems.length;i++){
elems[i].style.visibility="visible";
}
}
},

toggle: function(){
if(arguments.length>0){
for(var i=0; i<arguments.length; i++){
if(typeof(arguments[i])=='string'){arguments[i]=im_gui.obj(arguments[i]);}
if(typeof(arguments[i])=='object'){
if(arguments[i].style.display!='none'){
arguments[i].setAttribute('originaldisplaystyle', arguments[i].style.display);
arguments[i].style.display='none';
}else{
if(arguments[i].getAttribute('originaldisplaystyle')==null){
arguments[i].style.display='';
}else{
arguments[i].style.display=arguments[i].getAttribute('originaldisplaystyle');
}
}
}
}
}
},

hide: function(){
if(arguments.length>0){
for(var i=0; i<arguments.length; i++){
if(typeof(arguments[i])=='string'){arguments[i]=im_gui.obj(arguments[i]);}
if(typeof(arguments[i])=='object'){
if(arguments[i].style.display!='none'){
arguments[i].setAttribute('originaldisplaystyle', arguments[i].style.display);
arguments[i].style.display='none';
}
}
}
}
},

show: function(){
if(arguments.length>0){
for(var i=0; i<arguments.length; i++){
if(typeof(arguments[i])=='string'){arguments[i]=im_gui.obj(arguments[i]);}
if(typeof(arguments[i])=='object'){
if(arguments[i].style.display=='none'){
if(arguments[i].getAttribute('originaldisplaystyle')==null){
arguments[i].style.display='';
}else{
arguments[i].style.display=arguments[i].getAttribute('originaldisplaystyle');
}
}
}
}
}
}
},

datetime: {

sectotime: function(secs){
var h,m;
h=Math.floor(secs / 3600);
secs -= h*3600;
m=Math.floor(secs / 60);
secs -= m*60;
secs=Math.round(secs);
if (secs==60) secs=0;
return ((h>0?(h<10?'0'+h:h)+':':'')+(m<10?'0'+m:m)+':'+(secs<10?'0'+secs:secs));
}
},

string: {

pad: function(num,pad,size,side){
if(typeof(side)=='undefined'){var side='';}
if (num.length == size) return(num);
for (var i=num.length-1 ; i<size ; i++){
if (side=='right'){
num += ""+pad;
}else if (side=='left'){
num=""+pad+num;
}else{
num=""+pad+num+pad;
}
}
return (num);
},

limit_str: function(str, maxLength){
return (str.length > maxLength-4 ? str.substr(0, maxLength) + ' ...' : str);
},

strip_tags: function(str){
return str.replace(/<(:?[^>]+)>/gi, '');
}
},

input: {

initTxtInputs: function(){
var inps=im_gui.misc.obj("input","tag",document);
for(i=0;i<inps.length;i++){
if(inps[i].getAttribute("type")=='text'){
if(inps[i].getAttribute("invertValue")=='yes'){
inps[i].onfocus=function (){im_gui.input.invertValue(this,"focus",this.defaultValue);};
inps[i].onblur=function (){im_gui.input.invertValue(this,"blur",this.defaultValue);};
}
}
}
var inps=im_gui.misc.obj("textarea","tag",document);
for(i=0;i<inps.length;i++){
if(inps[i].getAttribute("invertValue")=='yes'){
inps[i].onfocus=function (){im_gui.input.invertValue(this,"focus",this.defaultValue);};
inps[i].onblur=function (){im_gui.input.invertValue(this,"blur",this.defaultValue);};
}
}
},

invertValue: function(objInput, evntRaised, strTxt){
if (evntRaised=="focus"){
if(objInput.value==strTxt){objInput.value='';}
}else if (evntRaised=="blur"){
if(objInput.value==''){objInput.value=strTxt;}
}
},

set_inspector: function(){
for(var i=0;i<arguments.length;i++){
if(typeof(arguments[i])=='string'){arguments[i]=im_gui.obj(arguments[i]);}
if(typeof(arguments[i])=='object'){
arguments[i].onkeypress=function(e){
var key = (document.all?event.keyCode:e.which);
var skey = (document.all?event.shiftKey:(key==16?true:false));
var div = document.createElement('div');div.id='label_'+(Math.random());
with(div.style){padding='3px';position='absolute';backgroundColor='#B1CDF2';color='#173863';fontSize='11px';
left=im_gui.misc.findPosX(this)+(this.offsetWidth+1)+'px';top=im_gui.misc.findPosY(this)+'px';};
if((key>=65&&key<=90&&!skey)||(key>=97&&key<=122&&skey)){div.innerHTML+='<div>CAPS LOCK: ON</div>';}
if(new RegExp('[א-ת]').test(this.value.substr(-1))){div.innerHTML+='Non-English character!</div>';}
if(div.innerHTML!=''){document.body.appendChild(div);
if(typeof(im_effects)=='object'){window.setTimeout('im_effects.fade(\''+div.id+'\', 0, 1000);', 1500);}
window.setTimeout('document.body.removeChild(im_gui.obj(\''+div.id+'\'));',2600);}
};
}
}
}
},

css: {
addClass: function(obj, theClassName){
if(typeof(obj)=='string'){var obj=im_gui.obj(obj);}
if(typeof(obj)!='object'){return false;}
obj.className=(obj.className=="" ? theClassName : (obj.className.indexOf(theClassName)==-1 ? obj.className+" "+theClassName : obj.className));
},

removeClass: function(obj, theClassName){
if(typeof(obj)=='string'){var obj=im_gui.obj(obj);}
if(typeof(obj)!='object'){return false;}
var regExp=new RegExp("\s?"+theClassName, 'g');
obj.className=obj.className.replace(regExp, '');
},

toggleClass: function(obj, theClassName){
if(typeof(obj)=='string'){var obj=im_gui.obj(obj);}
if(typeof(obj)!='object'){return false;}
if(obj.className.indexOf(theClassName)>-1){this.removeClass(obj,theClassName);}else{this.addClass(obj,theClassName);};
}
}
};var im_form = {

_defLangName : 'en',

_langsArr : new Array('he', 'en'),

_lang : {
'he' : {
'isNull' : "נא להזין מידע בשדה {FIELD}.",
'isTooShort' : "נא להזין לפחות {NUM} תווים בשדה {FIELD}.",
'isTooLong' : "נא להזין לכל היותר {NUM} תווים בשדה {FIELD}.",
'isNotNumber' : "נא להזין נתונים מספריים בלבד בשדה {FIELD}.",
'isNotBigger' : "ערך השדה {FIELD_1} חייב להיות גדול משדה {FIELD_2}.",
'isNotMultiplied' : "ערך השדה {FIELD_1} חייב להיות גדול משדה {FIELD_2} פי {NUM}.",
'isNotSmaller' : "ערך השדה {FIELD_1} חייב להיות קטן משדה {FIELD_2}.",
'isNotPositive': "ערך השדה {FIELD} אינו מספר חיובי.",
'isNotNegative': "ערך השדה {FIELD} אינו מספר שלילי.",
'isNotInt': "ערך השדה {FIELD} אינו מספר שלם.",
'isNotFloat': "ערך השדה {FIELD} אינו מספר עשרוני.",
'isNotEmail' : "אי מייל אינו תקין.",
'isNotEqualPassword' : "אימות סיסמא נכשלה.",
'isNotPhone' : "מספר טלפון בשדה {FIELD} אינו תקין.",
'isNotPrice' : "מחיר אינו תקין.",
'isNotHeb' : "נא להזין תווים בעברית בלבד בשדה {FIELD}.",
'isNotEng' : "נא להזין תווים באנגלית בלבד בשדה {FIELD}.",
'isNotChecked' : "חובה לסמן שדה {FIELD}.",
'isNotFile' : "חובה לבחור קובץ לשדה {FIELD}.",
'isNotAllowedExt' : "סיומת קובץ לא מורשת לשדה {FIELD}."
},
'en' : {
'isNull' : "{FIELD} field is required.",
'isTooShort' : "Please enter at least {NUM} chars. in {FIELD} field.",
'isTooLong' : "Please enter maximum {NUM} chars. in {FIELD} field.",
'isNotNumber' : "Please enter only numeric chars in {FIELD} field.",
'isNotBigger' : "Value of field {FIELD_1} must be bigger than the value of {FIELD_2}.",
'isNotMultiplied' : "Value of field {FIELD_1} must be {NUM} times the value of {FIELD_2}.",
'isNotSmaller' : "Value of field {FIELD_1} must be smaller than the value of {FIELD_2}.",
'isNotPositive': "Value of field {FIELD} must be a positive number.",
'isNotNegative': "Value of field {FIELD} must be a negative number.",
'isNotInt': "Value of field {FIELD} must be an integer number.",
'isNotFloat': "Value of field {FIELD} must be a decimal number.",
'isNotEmail' : "Invalid E-Mail address.",
'isNotEqualPassword' : "Second password field is not the same as the first one",
'isNotPhone' : "Value of field {FIELD} must a valid phone number",
'isNotPrice' : "Price is invalid",
'isNotHeb' : "Please enter only Hebrew characters in the {FIELD} field",
'isNotEng' : "Please enter only English characters in {FIELD} field",
'isNotChecked' : "You have to check the {FIELD} field",
'isNotAgreeTerms' : "You have to agree terms and conditions",
'isNotFile' : "You have to select file to the {FIELD} field",
'isNotAllowedExt' : "The file extention is not allowed for the {FIELD} field"
}
},

checkForm: function(formID, isBreakByAlert, isSubmitOnSuccess){
if(typeof(isBreakByAlert)=='undefined'){var isBreakByAlert = true;}
if(typeof(isSubmitOnSuccess)=='undefined'){var isSubmitOnSuccess = false;}
var str = this.validate(formID, 'inputErrorClass', isBreakByAlert);
if(str.indexOf('<ok />') == -1){
if(!isBreakByAlert){
alert(str.replace('<err />', ''));
}
return false;
}
if(isSubmitOnSuccess){document.getElementById(formID).submit();}else{return true;}
},

submitAjaxForm: function(formID, frmAction, finishFunction, isToSalat){
function submitAjaxForm_done(data){
alert(data);
}
var str = this._makeAjaxForm(formID);
if(str.indexOf('<err />')==-1){
im_ajax.send(frmAction, finishFunction ? finishFunction : im_form.submitAjaxForm_done, str, isToSalat);
}else{
return false;
}
},

_makeAjaxForm: function(formID){
var str = this.checkForm(formID);
if(str==false){return "<err />";}else{str = "";}
var formElement = document.getElementById(formID);
var inputsArr= formElement.elements;
for(i=0;i<inputsArr.length;i++){
switch(inputsArr[i].type.toLowerCase()){
case "radio":
case "checkbox":
if(inputsArr[i].checked){str += inputsArr[i].name + "=" + inputsArr[i].value + "&";}
break;
case "select-one":
case "select-multiple":
str += inputsArr[i].name + "=" + inputsArr[i].options[inputsArr[i].selectedIndex].value + "&";
break;
case "option":
case "reset":
break;
default:
str += inputsArr[i].name + "=" + inputsArr[i].value + "&";
}
}
str = str.substr(0,str.length-1);
return str;
},

validate: function(formID, errorClass, isBreakByAlert, langName){
if(formID=='' || !document.getElementById(formID)){alert("ERROR: '"+formID+"' Is not found!");return '';}
if(typeof(langName)=='undefined' || !this.is_inArray(langName, this._langsArr)){langName = this._defLangName;}
if(typeof(isBreakByAlert)=='undefined' || isBreakByAlert==null){isBreakByAlert = false;}
var theElem;
var formElement = document.getElementById(formID);
var inputsArr= formElement.elements;
var inpDefValue = inpValue = inpName = required = reqType = reqName = reqValue = err = fileExt = extParams = "";
var i = j = 0;
var isChecked = false;
var fieldArr = new Array();
for(i=0; i < inputsArr.length; i++){
theElem = inputsArr[i];
inpName = theElem.name;
required = theElem.getAttribute('required');
if(required!='' && required!=null){
if(!this._is_inArray(inpName, fieldArr)){
fieldArr[fieldArr.length] = inpName;
required= required.split(';');
reqType = required[0].split(':')[0];
reqName = required[0].split(':')[1];
reqValue = required[0].split(':')[2];
extParams= required[1];
inpValue = theElem.value;
inpDefValue = theElem.defaultValue;
if(inpValue!=inpDefValue || extParams.toUpperCase().indexOf('ALLOW_DEFAULT')==-1){
switch(theElem.type.toLowerCase()){
case "checkbox":
case "radio":
for(isChecked=false,j=0;j<inputsArr.length && !isChecked;j++){if(inputsArr[j].type==theElem.type && inputsArr[j].name==inpName && inputsArr[j].checked){isChecked = true;}}
if(!isChecked){
err += reqValue ? reqValue : this._setErrMsg(langName, (reqType=='terms' ? 'isNotAgreeTerms' : 'isNotChecked'), '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);return err;}
}else{this._removeErrClass(theElem, errorClass);}
break;
case "select-one":
case "select-multiple":
if(theElem.options[theElem.selectedIndex].value==''){
err += reqValue ? reqValue : this._setErrMsg(langName, 'isNotChecked', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);return err;}
}else{this._removeErrClass(theElem, errorClass);}
break;
case "file":
fileExt = inpValue.split('.');
fileExt = fileExt[fileExt.length-1].toLowerCase();
extParams = extParams.split(",")[0].split("|");
if(inpValue==''){
err += reqValue ? reqValue : this._setErrMsg(langName, 'isNotFile', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);return err;}
}else{
if(!this._is_inArray(fileExt,extParams)){
err += reqValue ? reqValue : this._setErrMsg(langName, 'isNotAllowedExt', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);return err;}
}else{this._removeErrClass(theElem, errorClass);}
}
break;
case "text":
case "hidden":
case "password":
case "textarea":
extParams = extParams ? extParams.split(':') : inpValue.length;
if(extParams.length>1){extParams[2] = extParams[1].substring(extParams[1].indexOf(','));extParams[1] = extParams[1].substring(0, extParams[1].indexOf(','));}
if(inpValue==inpDefValue || inpValue==''){
err +=  this._setErrMsg(langName, 'isNull', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else if( ((reqType!='numeric') || (extParams[0]>0)) && (inpValue.length < extParams[0]) ){
err += this._setErrMsg(langName, 'isTooShort', Array("{FIELD}","{NUM}"), Array(reqName,extParams[0]));
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else if( ((reqType!='numeric') || (extParams[0]>0)) && (inpValue.length > extParams[1]) ){
err += this._setErrMsg(langName, 'isTooLong', Array("{FIELD}","{NUM}"), Array(reqName,extParams[1]));
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{
switch(reqType.toLowerCase()){
case "any": this._removeErrClass(theElem, errorClass); break;
case "numeric":
if(!this._is_valid_string(inpValue, 'NUMBER')){
err += reqValue ? reqValue : this._setErrMsg(langName, 'isNotNumber', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{
this._removeErrClass(theElem, errorClass);
if(extParams.join().toUpperCase().indexOf('POSITIVE') > -1){
if(parseInt(inpValue) < 0){
err += this._setErrMsg(langName, 'isNotPositive', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{this._removeErrClass(theElem, errorClass);}
}else if(extParams.join().toUpperCase().indexOf('NEGATIVE') > -1){
if(parseInt(inpValue) > 0){
err += this._setErrMsg(langName, 'isNotNegative', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{this._removeErrClass(theElem, errorClass);}
}
if(extParams.join().toUpperCase().indexOf('INT') > -1){
if(!this._is_valid_string(inpValue, 'INT')){
err += this._setErrMsg(langName, 'isNotInt', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{this._removeErrClass(theElem, errorClass);}
}else if(extParams.join().toUpperCase().indexOf('FLOAT') > -1){
if(!this._is_valid_string(inpValue, 'FLOAT')){
err += this._setErrMsg(langName, 'isNotFloat', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{this._removeErrClass(theElem, errorClass);}
}
switch(extParams[0].toUpperCase()){
case 'GREATER_THAN':
if(inpValue<=parseInt(eval('formElement.'+extParams[1]).value+extParams[3])){
err += this._setErrMsg(langName, 'isNotBigger', Array("{FIELD_1}","{FIELD_2}"), Array(reqName,extParams[2]));
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{this._removeErrClass(theElem, errorClass);}
break;
case 'SMALLER_THAN':
if(inpValue>=parseInt(eval('formElement.'+extParams[1]).value+extParams[3])){
err += this._setErrMsg(langName, 'isNotSmaller', Array("{FIELD_1}","{FIELD_2}"), Array(reqName,extParams[2]));
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{this._removeErrClass(theElem, errorClass);}
break;
case 'MULTIPLIED_BY':
if(inpValue!=parseInt(eval('formElement.'+extParams[1]).value*extParams[3])){
err += this._setErrMsg(langName, 'isNotMultiplied', Array("{FIELD_1}","{FIELD_2}","{NUM}"), Array(reqName,extParams[2],extParams[3]));
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{this._removeErrClass(theElem, errorClass);}
break;
}
}
break;
case "email":
if(!this._is_valid_string(inpValue, 'EMAIL')){
err += reqValue ? reqValue : this._setErrMsg(langName, 'isNotEmail', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{this._removeErrClass(theElem, errorClass);}
break;
case "phone":
if(!this._is_valid_string(inpValue, 'PHONE')){
err += reqValue ? reqValue : this._setErrMsg(langName, 'isNotPhone', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{this._removeErrClass(theElem, errorClass);}
break;
case "price":
if(!this._is_valid_string(inpValue, 'PRICE')){
err += reqValue ? reqValue : this._setErrMsg(langName, 'isNotPrice', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{this._removeErrClass(theElem, errorClass);}
break;
case "hebrew":
if(!this._is_valid_string(inpValue, 'HEBREW')){
err += reqValue ? reqValue : this._setErrMsg(langName, 'isNotHeb', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{this._removeErrClass(theElem, errorClass);}
break;
case "english":
if(!this._is_valid_string(inpValue, 'ENGLISH')){
err += reqValue ? reqValue : this._setErrMsg(langName, 'isNotEng', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{this._removeErrClass(theElem, errorClass);}
break;
case "password":
if(extParams && extParams!=''){
if(inpValue!=eval('formElement.'+extParams[0]).value){
err += reqValue ? reqValue : this._setErrMsg(langName, 'isNotEqualPassword', '{FIELD}', reqName);
this._setErrClass(theElem, errorClass);
if(isBreakByAlert){alert(err);theElem.focus();return err;}
}else{this._removeErrClass(theElem, errorClass);}
}
break;
default:
break;
}
}
break;
default:
break;
}
}
}
}
}
return (err=='' ? '<ok />' : '<err />'+err);
},

_is_inArray: function(str, arr){
for(i in arr){if(str == arr[i]){return true;}}
return false;
},

_setErrClass: function(theElem, errorClass){
if(theElem.className.indexOf(errorClass) == -1){
theElem.setAttribute('orgClass',theElem.className);
theElem.className =  (theElem.className=="" ? errorClass : theElem.className + " " + errorClass);
}
},

_removeErrClass: function(theElem, errorClass){
var ptrn = new RegExp(" ?"+errorClass);
theElem.className = theElem.className.replace(ptrn, "");
},

_setErrMsg: function(langName, errKey, tmplArr, replaceArr){
var errorStr = this._lang[langName][errKey];
if(typeof(tmplArr)=='string'){
errorStr = errorStr.replace(tmplArr,replaceArr);
}else{
for(i in tmplArr){errorStr = errorStr.replace(tmplArr[i],replaceArr[i])}
}
return errorStr + "\n";
},_is_valid_string: function(testStr, format){
var ptrn = "";
switch(format.toUpperCase()){
case 'INT': ptrn = "^\-?[0-9]+$"; break;
case 'FLOAT': ptrn = "^\-?[0-9]+\.[0-9]+$"; break;
case 'PHONE': ptrn = "^(:?[0-9]+\-)*[0-9]+$"; break;
case 'NUMBER': ptrn = "^\-?[0-9\.?]+[^\.]$"; break;
case 'PRICE': ptrn = "^[0-9]+(:?\.[0-9]+)?$"; break;
case 'HEBREW': ptrn = "[א-ת ]+"; break;
case 'ENGLISH': ptrn = "[a-zA-Z ]+"; break;
case 'EMAIL': ptrn = "^[\-a-z0-9\_\.]+@([\-a-z0-9]+\.)+[a-z]{2,}$"; break;
case 'PASSWORD': ptrn = "[\w]+"; break;
}
ptrn = new RegExp(ptrn);
return ptrn.test(testStr);
}
};var im_center = {
curDiv_num: 0,
_is_cover_screen: false,
_is_dragndrop: false,
sizesArr: new Array(),

show: function(sizeKey, objContent, isMkCover, isMkDragNDrop){
if(typeof(sizeKey)=='string' && typeof(this.sizesArr[sizeKey])=='undefined'){sizeKey = 'default';}
if(typeof(isMkCover)=='undefined' || isMkCover==''){var isMkCover=this._is_cover_screen;}
if(typeof(isMkDragNDrop)=='undefined' || isMkDragNDrop==''){var isMkDragNDrop=this._is_dragndrop;}
var objSize= (typeof(sizeKey)=='string' ? this.sizesArr[sizeKey] : sizeKey);
var objPos = im_gui.window.getCenterizedPos(objSize.width, objSize.height);
var divCenterObj = document.createElement('div');
this.curDiv_num++;
if(isMkCover){
var divCoverObj= document.createElement('div');
with(divCoverObj){
className = "im_coverDiv";
id = "im_coverDiv_"+this.curDiv_num;
onclick = function(){im_center.close();}
with(style){position="fixed";left="0px";top="0px";width="100%";height="100%";}

}
document.body.appendChild(divCoverObj);
}
if(isMkDragNDrop){if(typeof(im_dragndrop)=="object"){im_dragndrop.set(divCenterObj);}}
with(divCenterObj){
id = "im_centerDiv_"+this.curDiv_num;
className = "im_centerDiv";
with(style){position="absolute";left=objPos.x+"px";top=objPos.y+"px";width=objSize.width+"px";height=objSize.height+"px";zIndex='1';}
innerHTML = objContent;
}
im_gui.display.hideDLLObjs();
document.body.appendChild(divCenterObj);
if(im_gui.browser.ie6){
divCenterObj.style.zIndex = '1000000'; 
}
},

close: function(){
if(this.curDiv_num > 0){
var divCenterObj = im_gui.misc.obj('im_centerDiv_'+this.curDiv_num);
document.body.removeChild(divCenterObj);
var divCoverObj = im_gui.misc.obj('im_coverDiv_'+this.curDiv_num);
if(divCoverObj){document.body.removeChild(divCoverObj);}
this.curDiv_num--;
if(this.curDiv_num==0){im_gui.display.showDLLObjs();}
}
},

innerContent: function(data){
im_gui.misc.innerData('im_centerDiv_contentCell_'+this.curDiv_num, data);
},

appendObj: function(obj){
if(typeof(obj)=='object'){
im_gui.misc.obj('im_centerDiv_contentCell_'+this.curDiv_num).appendChild(obj);
}
},

templates: {
tmplArr: new Array(),

compile: function(args, tmplName){
if(typeof(tmplName)=='undefined' || tmplName==''){var tmplName='default';}
var templateLayout = this.tmplArr[tmplName];
for(key in args){templateLayout = templateLayout.replace(new RegExp('{'+key+'}', 'g'), args[key]);}
templateLayout = templateLayout.replace(/{DIVNUM}/g, im_center.curDiv_num+1);
return templateLayout;
},

register: function(){
if(arguments.length==1 && typeof(arguments[0])=='object'){
for(i in arguments[0]){this.tmplArr[i] = arguments[0][i];}
return true;
}else{
return false;
}
}
}
};
im_center.sizesArr['default'] = {width: 300, height: 200};
im_center.templates.register({'default':''});var im_dragndrop = {
_isDragRealTime: true,

_dragableObj: null,
_mouseMove_bk: null,
_OBJECT: null,
_AXLE: '',
_DIFF: {x: 0,y: 0},
_IS_GRIPPED: false,

grip: function(e, obj, isDragRealTime, axle){
if(this._IS_GRIPPED){this.drop();this._IS_GRIPPED=false;return false;}
if(typeof(obj)=='string'){obj = im_gui.obj(obj);}
if(typeof(isDragRealTime)=='undefined' || isDragRealTime==''){var isDragRealTime = this._isDragRealTime;}
if(typeof(isDragRealTime)=='string'){isDragRealTime = eval(isDragRealTime);}
if(typeof(axle)=='undefined'){var axle = '';}
var MOUSE = this.getMousePos(e);
var POS = {left: im_gui.misc.findPosX(obj), top: im_gui.misc.findPosY(obj)};
this._DIFF.x = MOUSE.x-POS.left;
this._DIFF.y = MOUSE.y-POS.top;
this._OBJECT = obj;
this._AXLE = axle;
if(isDragRealTime){
this._dragableObj = obj;
}else{
var dummyDiv = document.createElement("div");
dummyDiv.className = "im_dragNdropDiv";
dummyDiv.id = "im_dragNdropDiv";
with(dummyDiv.style){position="absolute";width=obj.offsetWidth+"px";height=obj.offsetHeight+"px";left=POS.left+"px";top=POS.top+"px";};
this._dragableObj = dummyDiv;
document.body.appendChild(dummyDiv);
this._dragableObj = dummyDiv;
}
this._mouseMove_bk = document.onmousemove;
im_gui.misc.textSelection(this._OBJECT, false);
im_gui.misc.textSelection(document.body, false);
document.onmousemove = function(e){im_dragndrop.drag(e);};
this._dragableObj.onmouseup = function(e){im_dragndrop.drop();};
this._dragableObj.style.cursor = "move";
this._IS_GRIPPED=true;
return false;
},

drag: function(e){
var MOUSE = this.getMousePos(e);
var POS = {x: MOUSE.x-this._DIFF.x, y: MOUSE.y-this._DIFF.y};
with(this._dragableObj.style){if(this._AXLE!='y'){left = POS.x+"px";}if(this._AXLE!='x'){top = POS.y+"px";}};
if(typeof(this._mouseMove_bk)!='undefined'&&this._mouseMove_bk!=null){this._mouseMove_bk(e);}
},

drop: function(){
document.onmousemove = (typeof(this._mouseMove_bk)!='undefined'&&this._mouseMove_bk!=null?this._mouseMove_bk:null);
var dummyObj = im_gui.obj('im_dragNdropDiv');
if(dummyObj){
var POS = {left: im_gui.misc.findPosX(dummyObj), top: im_gui.misc.findPosY(dummyObj)};
with(this._OBJECT.style){left=(POS.left)+"px";top=(POS.top)+"px";};
document.body.removeChild(dummyObj);
}
this._OBJECT.style.cursor = "auto";
im_gui.misc.textSelection(this._OBJECT, true);
im_gui.misc.textSelection(document.body, true);
},

getMousePos: function(e){
return (document.all ? {x: event.clientX , y: event.clientY} : {x: e.pageX, y: e.pageY});
},

set: function(obj, isDragRealTime, axle){
if(typeof(obj)=='string'){obj = im_gui.obj(obj);}
if(typeof(isDragRealTime)=='undefined'){isDragRealTime = this._isDragRealTime;}
if(typeof(axle)=='undefined'){axle = "";}
if(obj.style.position!="absolute"){obj.style.position="absolute";}
obj.setAttribute("isdragrealtime", isDragRealTime);obj.setAttribute("axle", axle);
obj.onmousedown = function(e){im_dragndrop.grip(e, this, this.getAttribute("isdragrealtime"), this.getAttribute("axle"));}
}
};var im_ajax = {

isAjaxProcessing: false,
isDebug: false,
xmlhttp: null,
_retFunc: null,send: function(page,retFunc,extras,isFromSalat,isGetXML){
if (typeof(isFromSalat)== "undefined") isFromSalat = false;
if (typeof(isGetXML)== "undefined") isGetXML= false;
if (typeof(extras)=="undefined") extras = '';
this.xmlhttp = this._createXMLHTTPObject();
extras = 'file='+page+'&'+extras;
if (this.xmlhttp){
if (isFromSalat){
this.xmlhttp.open("POST", "/salat2/_ajax/ajax.index.php", true);
}else{
this.xmlhttp.open("POST", "/_ajax/ajax.index.php", true);
}
if (this.isDebug) alert('before ajax');
this._retFunc = retFunc;
this.xmlhttp.onreadystatechange = function(){

try{ if (im_ajax.xmlhttp.readyState == 4){ if (im_ajax.xmlhttp.status == 200){
if (this.isDebug) alert('in ajax');
this.isAjaxProcessing = false;
document.body.style.cursor = "auto";
retFunc((isGetXML ? im_ajax.xmlhttp.responseXML : im_ajax.xmlhttp.responseText));
}}}catch(e){ alert("XMLHTTP Error\n\n"+e.message); this.isAjaxProcessing=false; }
};
this.xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

this.isAjaxProcessing = true;
this.xmlhttp.send(extras);
document.body.style.cursor = "wait";
return (true);
}else{
alert("You browser does not support Ajax functionality");
return (false);
}
},

innerData: function(id, data, addingPos){
if(typeof(id)=='object'){
if(typeof(addingPos)=='undefined' || !addingPos){
id.innerHTML = data;
}else if(addingPos=='begin' || addingPos=='before'){
id.innerHTML = data + id.innerHTML;
}else if(addingPos=='end' || addingPos=='after'){
id.innerHTML += data;
}
}else{
if(typeof(addingPos)=='undefined' || !addingPos){
this.obj(id).innerHTML = data;
}else if(addingPos=='begin' || addingPos=='before'){
this.obj(id).innerHTML = data + this.obj(id).innerHTML;
}else if(addingPos=='end' || addingPos=='after'){
this.obj(id).innerHTML += data;
}
}
},

evalScript: function(){
var tmp = document.getElementById('ajaxScript');
if (tmp){
if(tmp.innerHTML && tmp.innerHTML!=''){
try{
eval(tmp.innerHTML);
tmp.parentNode.removeChild(tmp);
}catch(e){

}
}
}
},

sendMulti: function(arrReqs,isFromSalat){

},

_createXMLHTTPObject: function(){
var xmlhttpTmp = false;
var factories = this._XMLHttpFactories();
for (var i=0;i<factories.length;i++){
try{
xmlhttpTmp = factories[i]();
}catch (e){
continue;
}
break;
}
return xmlhttpTmp;
},

_XMLHttpFactories: function(){
return[
function () {return new XMLHttpRequest()},
function () {return new ActiveXObject("Msxml2.XMLHTTP")},
function () {return new ActiveXObject("Msxml3.XMLHTTP")},
function () {return new ActiveXObject("Microsoft.XMLHTTP")}
];
}

};var im_effects = {

_isRunnig: false,
_timerPointer: 0,
_curOpacity: 0,
_destOpacity: 0,

_opacityPerStep: 5,
_curStep: 0,
_totalSteps: 0,

_endFunc: '',


fadeTo: function(obj, destFade, milsecs, endFunc){

if(typeof(obj)=='string'){ obj = im_gui.obj(obj); }
this._curObj = obj;

this._destOpacity = destFade;
this._curOpacity = im_gui.display.getObjOpacity(this._curObj);



this._totalSteps = ( Math.abs( this._curOpacity - this._destOpacity) / this._opacityPerStep );

this._timerPointer = setInterval("im_effects.fadeTo_run()", (milsecs / this._totalSteps) );

},

fadeTo_run: function(){

if (this._curStep == this._totalSteps){
clearInterval(this._timerPointer);
if (this._endFunc) this._endFunc();
return true;
};
if ( this._curOpacity > this._destOpacity){
this._curOpacity -= this._opacityPerStep;
}else{
this._curOpacity += this._opacityPerStep;
}
im_gui.display.setOpacity( this._curObj , this._curOpacity );
this._curStep++;

},

fade: function(objId, opacEnd, time){
if(typeof(objId)=='string'){ obj = im_gui.obj(objId); }
var speed=Math.round(time / 100);
    var frame=i=0;
    var opacStart=im_gui.display.getObjOpacity(objId);;
    if(opacStart > opacEnd){
        for(i = opacStart; i >= opacEnd; i--) {
            window.setTimeout("im_gui.display.setOpacity('" + objId + "'," + i + ")",(frame * speed));
            frame++;
        }
    }else if(opacStart < opacEnd){
        for(i = opacStart; i <= opacEnd; i++){
            window.setTimeout("im_gui.display.setOpacity('" + objId + "'," + i + ")",(frame * speed));
            frame++;
        }
    }
}

};var xmlhttp;function doAjax(page,retFunc,extras,isFromSalat){

if (typeof isFromSalat == "undefined") isFromSalat = false;
var xmlhttp = createXMLHTTPObject();
if (xmlhttp){

if (isFromSalat) xmlhttp.open(((extras) ? "POST" : "GET"), "/salat2/_ajax/"+page, true);
else xmlhttp.open(((extras) ? "POST" : "GET"), "/_ajax/"+page, true);
xmlhttp.onreadystatechange = function(){
try{ if (xmlhttp.readyState == 4){ if (xmlhttp.status == 200){
retFunc(xmlhttp.responseText);
}}}catch(e){  }
};

xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send(extras);
return (true);
}else{
alert("You browser does not support Ajax functionality");
return (false);
}
}function createXMLHTTPObject(){
var xmlhttp = false;
var factories = XMLHttpFactories();
for (var i=0;i<factories.length;i++){
try{
xmlhttp = factories[i]();
}catch (e){
continue;
}
break;
}
return xmlhttp;
}function XMLHttpFactories(){
return[
function () {return new XMLHttpRequest()},
function () {return new ActiveXObject("Msxml2.XMLHTTP")},
function () {return new ActiveXObject("Msxml3.XMLHTTP")},
function () {return new ActiveXObject("Microsoft.XMLHTTP")}
];
}function pngFix(id){
if(!$(id)){
return false;
}
navinfo = navigator.userAgent;
if(navinfo.indexOf("MSIE 6.0")!=(-1)){
if (document.all && document.body.filters){
tofix = document.getElementById(id).getElementsByTagName('img');
for(var i=0; i<tofix.length; i++){
var img = tofix[i];
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG"){
var imgID = (img.id) ? "id='" + img.id + "' " : "";
var imgClass = (img.className) ? "class='" + img.className + "' " : "";
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
var imgStyle = "display:inline-block;" + img.style.cssText ;
if (img.align == "left") imgStyle = "float:left;" + imgStyle;
if (img.align == "right") imgStyle = "float:right;" + imgStyle;
var imgClick = (img.onclick != null) ? "onclick=\"" + img.onclick + "; anonymous();\"" : "";
if (img.parentElement.href) imgStyle = "cursor:pointer;" + imgStyle;
var strNewHTML = "<span " + imgID + imgClass + imgTitle + imgClick 
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
img.outerHTML = strNewHTML;
i = i-1;
};
};
};
};
};function is_email(email){
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if(reg.test(email)){
return true;
}else{
return false;
}
}
var user_string = 'User';
$(document).ready(function(){
$('.login-div [name=username]').val(user_string).focus(function(){
if($(this).val() == user_string){
$(this).val('');
}
}).blur(function(){
if($(this).val()==''){
$(this).val(user_string);
}
});

$('.login-div form').submit(function(){
if($(this).find('[name=username]').val() == user_string ||$(this).find('[name=password]').val() == ''){
alert('Please enter user name and password');
return false;
}
return true;
});

$('.login-required').click(function(){
var pos = $(this).offset();
var login_div = $('<div></div>').addClass('login-req-div dark-blue-t').css({
'top':pos.top-20,
'left':pos.left-10
}).html('Login is required for this action').appendTo($('body')).fadeIn('slow',function(){
window.setTimeout(function(){
login_div.fadeOut('slow');
},2500);
}).mouseout(function(){
$(this).fadeOut('slow');
}).click(function(){
$(this).fadeOut('slow');
});
});

im_center.sizesArr['msg_screen'] = {width: 320, height: 100};
im_center.sizesArr['friendsList'] = {width: 400, height: 300};
im_center.sizesArr['contactList'] = {width: 300, height: 400};
im_center.sizesArr['saveaprayer'] = {width: 400, height: 250};
im_center.sizesArr['joinaprayer'] = {width: 400, height: 430};
im_center.sizesArr['updateprayer'] = {width: 550, height: 400};
im_center.sizesArr['sendToFriend'] = {width: 400, height: 300};
im_center.sizesArr['sendTxtMsg'] = {width: 400, height: 300};im_center.templates.register({
'default': '<div class="login-req-div dark-blue-t"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td style="font-size:15px;">{TITLE}</td><td width="10" class="pointer" onclick="javascript:im_center.close();">X</td></tr></table><br/>{CONTENT}</div>',
'closeBtn': '<div class="login-req-div dark-blue-t"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td style="font-size:15px;">{TITLE}</td><td width="10" class="pointer">{CLOSE_BTN}</td></tr></table><br/>{CONTENT}</div>'
});

});var is_languages_open = false;
var languages_timer;
function show_languages(){
clearTimeout(languages_timer);
if(is_languages_open) return;
$('#languages_list').slideDown('slow');
is_languages_open = true;
}function hide_languages(){
clearTimeout(languages_timer);
if(!is_languages_open) return;
languages_timer = setTimeout(function(){
if(!is_languages_open) return;
$('#languages_list').slideUp('slow');
is_languages_open = false;
},500);
}function saveAprayer(prayerID, imgID){
im_center.close();
im_ajax.send('user.prayer.save.ajax.php', function(data){
im_center.show('msg_screen',
im_center.templates.compile({
'TITLE': 'Saving a prayer',
'CONTENT': data
})
);
im_ajax.evalScript();
}, 'prayer_id='+prayerID+'&img_id='+imgID);
}function sendToFriend(item_type, item_id, item_title){
if(typeof(popupOverPrayer)=='function'){popupOverPrayer(true);}
im_center.close();
im_ajax.send('sendtofriend.ajax.php', function(data){
im_center.show('sendToFriend',
im_center.templates.compile({
'TITLE': "Send an item to a friend",
'CLOSE_BTN': '<div class="closeButton" onclick="javascript: im_center.close();if(typeof(popupOverPrayer)==\'function\'){popupOverPrayer(false);}">X</div>',
'CONTENT': data
}, 'closeBtn')
);
}, 'item_id='+item_id+'&item_type='+item_type+'&item_title='+item_title);
}function sendMailToFriend(){
im_form.submitAjaxForm('frmSendToFriend', 'sendtofriend.ajax.php', function(data){
im_center.close();
im_center.show('sendToFriend',
im_center.templates.compile({
'TITLE': "Send an item to a friend",
'CLOSE_BTN': '<div class="closeButton" onclick="javascript: im_center.close();if(typeof(popupOverPrayer)==\'function\'){popupOverPrayer(false);}">X</div>',
'CONTENT': data
}, 'closeBtn')
);
});
}
var images_path = '/_media/images/newhome/';
var menuTimerID = 0;
$(document).ready(function(){
$('#top-menu-btns').find('.btn').mouseover(function(){
var current_btn = $(this);
var channel_id = current_btn.attr('id').split('_').slice(-1);
window.clearTimeout(menuTimerID);
$('#top-menu-btns').find('.btn').each(function(){
if(current_btn.attr('id')!=$(this).attr('id')){
$(this).attr('src',images_path + $(this).attr('outsrc'));
}
});
current_btn.attr('src',images_path + current_btn.attr('onsrc'));
$('.menu > .links').html($('#links_content_' + channel_id).html());
}).mouseout(function(){
menuTimerID=window.setTimeout(function(){
goToDefaultChannel();
}, 120);
});
$('.menu > .links').mouseover(function(){
window.clearTimeout(menuTimerID);
}).mouseout(function(){
menuTimerID=window.setTimeout(function(){
goToDefaultChannel();
}, 120);
});
goToDefaultChannel();
});function goToDefaultChannel(){
$('#top-menu-btns').find('.btn').each(function(){
$(this).attr('src',images_path + $(this).attr('outsrc'));
});
if(_cur_channel_id<1){return false;}
jQuery('#menu_btn_'+_cur_channel_id).attr('src',images_path + jQuery('#menu_btn_'+_cur_channel_id).attr('onsrc'));
$('.menu > .links').html($('#links_content_' + _cur_channel_id).html());
};(function($) {$.fn.ajaxSubmit = function(options) {
    
    if (!this.length) {
        log('ajaxSubmit: skipping submit process - no element selected');
        return this;
    }    if (typeof options == 'function')
        options = { success: options };    options = $.extend({
        url:  this.attr('action') || window.location.toString(),
        type: this.attr('method') || 'GET'
    }, options || {});    
    
    var veto = {};
    this.trigger('form-pre-serialize', [this, options, veto]);
    if (veto.veto) {
        log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
        return this;
    }    
    if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
        log('ajaxSubmit: submit aborted via beforeSerialize callback');
        return this;
    }    
   
    var a = this.formToArray(options.semantic);
    if (options.data) {
        options.extraData = options.data;
        for (var n in options.data) {
          if(options.data[n] instanceof Array) {
            for (var k in options.data[n])
              a.push( { name: n, value: options.data[n][k] } )
          }  
          else
             a.push( { name: n, value: options.data[n] } );
        }
    }    
    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
        log('ajaxSubmit: submit aborted via beforeSubmit callback');
        return this;
    }        
    this.trigger('form-submit-validate', [a, this, options, veto]);
    if (veto.veto) {
        log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
        return this;
    }        var q = $.param(a);    if (options.type.toUpperCase() == 'GET') {
        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
        options.data = null;  
    }
    else
        options.data = q;     var $form = this, callbacks = [];
    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });    
    if (!options.dataType && options.target) {
        var oldSuccess = options.success || function(){};
        callbacks.push(function(data) {
            $(options.target).html(data).each(oldSuccess, arguments);
        });
    }
    else if (options.success)
        callbacks.push(options.success);    options.success = function(data, status) {
        for (var i=0, max=callbacks.length; i < max; i++)
            callbacks[i].apply(options, [data, status, $form]);
    };    
    var files = $('input:file', this).fieldValue();
    var found = false;
    for (var j=0; j < files.length; j++)
        if (files[j])
            found = true;    
   if (options.iframe || found) { 
       
       
       if ($.browser.safari && options.closeKeepAlive)
           $.get(options.closeKeepAlive, fileUpload);
       else
           fileUpload();
       }
   else
       $.ajax(options);    
    this.trigger('form-submit-notify', [this, options]);
    return this;    
    function fileUpload() {
        var form = $form[0];
        
        if ($(':input[name=submit]', form).length) {
            alert('Error: Form elements must not be named "submit".');
            return;
        }
        
        var opts = $.extend({}, $.ajaxSettings, options);
var s = jQuery.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);        var id = 'jqFormIO' + (new Date().getTime());
        var $io = $('<iframe id="' + id + '" name="' + id + '" />');
        var io = $io[0];        if ($.browser.msie || $.browser.opera) 
            io.src = 'javascript:false;document.write("");';
        $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });        var xhr = { 
            aborted: 0,
            responseText: null,
            responseXML: null,
            status: 0,
            statusText: 'n/a',
            getAllResponseHeaders: function() {},
            getResponseHeader: function() {},
            setRequestHeader: function() {},
            abort: function() { 
                this.aborted = 1; 
                $io.attr('src','about:blank'); 
            }
        };        var g = opts.global;
        
        if (g && ! $.active++) $.event.trigger("ajaxStart");
        if (g) $.event.trigger("ajaxSend", [xhr, opts]);if (s.beforeSend && s.beforeSend(xhr, s) === false) {
s.global && jQuery.active--;
return;
        }
        if (xhr.aborted)
            return;
        
        var cbInvoked = 0;
        var timedOut = 0;        
        var sub = form.clk;
        if (sub) {
            var n = sub.name;
            if (n && !sub.disabled) {
                options.extraData = options.extraData || {};
                options.extraData[n] = sub.value;
                if (sub.type == "image") {
                    options.extraData[name+'.x'] = form.clk_x;
                    options.extraData[name+'.y'] = form.clk_y;
                }
            }
        }        
        setTimeout(function() {
            
            var t = $form.attr('target'), a = $form.attr('action');
            $form.attr({
                target:   id,
                method:   'POST',
                action:   opts.url
            });
            
            
            if (! options.skipEncodingOverride) {
                $form.attr({
                    encoding: 'multipart/form-data',
                    enctype:  'multipart/form-data'
                });
            }            
            if (opts.timeout)
                setTimeout(function() { timedOut = true; cb(); }, opts.timeout);            
            var extraInputs = [];
            try {
                if (options.extraData)
                    for (var n in options.extraData)
                        extraInputs.push(
                            $('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')
                                .appendTo(form)[0]);
            
                
                $io.appendTo('body');
                io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
                form.submit();
            }
            finally {
                
                $form.attr('action', a);
                t ? $form.attr('target', t) : $form.removeAttr('target');
                $(extraInputs).remove();
            }
        }, 10);        function cb() {
            if (cbInvoked++) return;
            
            io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);            var operaHack = 0;
            var ok = true;
            try {
                if (timedOut) throw 'timeout';
                
                var data, doc;                doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
                
                if (doc.body == null && !operaHack && $.browser.opera) {
                    
                    
                    operaHack = 1;
                    cbInvoked--;
                    setTimeout(cb, 100);
                    return;
                }
                
                xhr.responseText = doc.body ? doc.body.innerHTML : null;
                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
                xhr.getResponseHeader = function(header){
                    var headers = {'content-type': opts.dataType};
                    return headers[header];
                };                if (opts.dataType == 'json' || opts.dataType == 'script') {
                    var ta = doc.getElementsByTagName('textarea')[0];
                    xhr.responseText = ta ? ta.value : xhr.responseText;
                }
                else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
                    xhr.responseXML = toXml(xhr.responseText);
                }
                data = $.httpData(xhr, opts.dataType);
            }
            catch(e){
                ok = false;
                $.handleError(opts, xhr, 'error', e);
            }            
            if (ok) {
                opts.success(data, 'success');
                if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
            }
            if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
            if (g && ! --$.active) $.event.trigger("ajaxStop");
            if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');            
            setTimeout(function() {
                $io.remove();
                xhr.responseXML = null;
            }, 100);
        };        function toXml(s, doc) {
            if (window.ActiveXObject) {
                doc = new ActiveXObject('Microsoft.XMLDOM');
                doc.async = 'false';
                doc.loadXML(s);
            }
            else
                doc = (new DOMParser()).parseFromString(s, 'text/xml');
            return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
        };
    };
}; 
$.fn.ajaxForm = function(options) {
    return this.ajaxFormUnbind().bind('submit.form-plugin',function() {
        $(this).ajaxSubmit(options);
        return false;
    }).each(function() {
        
        $(":submit,input:image", this).bind('click.form-plugin',function(e) {
            var form = this.form;
            form.clk = this;
            if (this.type == 'image') {
                if (e.offsetX != undefined) {
                    form.clk_x = e.offsetX;
                    form.clk_y = e.offsetY;
                } else if (typeof $.fn.offset == 'function') { 
                    var offset = $(this).offset();
                    form.clk_x = e.pageX - offset.left;
                    form.clk_y = e.pageY - offset.top;
                } else {
                    form.clk_x = e.pageX - this.offsetLeft;
                    form.clk_y = e.pageY - this.offsetTop;
                }
            }
            
            setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 10);
        });
    });
};$.fn.ajaxFormUnbind = function() {
    this.unbind('submit.form-plugin');
    return this.each(function() {
        $(":submit,input:image", this).unbind('click.form-plugin');
    });};$.fn.formToArray = function(semantic) {
    var a = [];
    if (this.length == 0) return a;    var form = this[0];
    var els = semantic ? form.getElementsByTagName('*') : form.elements;
    if (!els) return a;
    for(var i=0, max=els.length; i < max; i++) {
        var el = els[i];
        var n = el.name;
        if (!n) continue;        if (semantic && form.clk && el.type == "image") {
            
            if(!el.disabled && form.clk == el)
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
            continue;
        }        var v = $.fieldValue(el, true);
        if (v && v.constructor == Array) {
            for(var j=0, jmax=v.length; j < jmax; j++)
                a.push({name: n, value: v[j]});
        }
        else if (v !== null && typeof v != 'undefined')
            a.push({name: n, value: v});
    }    if (!semantic && form.clk) {
        
        var inputs = form.getElementsByTagName("input");
        for(var i=0, max=inputs.length; i < max; i++) {
            var input = inputs[i];
            var n = input.name;
            if(n && !input.disabled && input.type == "image" && form.clk == input)
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
        }
    }
    return a;
};$.fn.formSerialize = function(semantic) {
    
    return $.param(this.formToArray(semantic));
};$.fn.fieldSerialize = function(successful) {
    var a = [];
    this.each(function() {
        var n = this.name;
        if (!n) return;
        var v = $.fieldValue(this, successful);
        if (v && v.constructor == Array) {
            for (var i=0,max=v.length; i < max; i++)
                a.push({name: n, value: v[i]});
        }
        else if (v !== null && typeof v != 'undefined')
            a.push({name: this.name, value: v});
    });
    
    return $.param(a);
};$.fn.fieldValue = function(successful) {
    for (var val=[], i=0, max=this.length; i < max; i++) {
        var el = this[i];
        var v = $.fieldValue(el, successful);
        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
            continue;
        v.constructor == Array ? $.merge(val, v) : val.push(v);
    }
    return val;
};$.fieldValue = function(el, successful) {
    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
    if (typeof successful == 'undefined') successful = true;    if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
        (t == 'checkbox' || t == 'radio') && !el.checked ||
        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
        tag == 'select' && el.selectedIndex == -1))
            return null;    if (tag == 'select') {
        var index = el.selectedIndex;
        if (index < 0) return null;
        var a = [], ops = el.options;
        var one = (t == 'select-one');
        var max = (one ? index+1 : ops.length);
        for(var i=(one ? index : 0); i < max; i++) {
            var op = ops[i];
            if (op.selected) {
                
                var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
                if (one) return v;
                a.push(v);
            }
        }
        return a;
    }
    return el.value;
};$.fn.clearForm = function() {
    return this.each(function() {
        $('input,select,textarea', this).clearFields();
    });
};$.fn.clearFields = $.fn.clearInputs = function() {
    return this.each(function() {
        var t = this.type, tag = this.tagName.toLowerCase();
        if (t == 'text' || t == 'password' || tag == 'textarea')
            this.value = '';
        else if (t == 'checkbox' || t == 'radio')
            this.checked = false;
        else if (tag == 'select')
            this.selectedIndex = -1;
    });
};$.fn.resetForm = function() {
    return this.each(function() {
        
        
        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
            this.reset();
    });
};$.fn.enable = function(b) { 
    if (b == undefined) b = true;
    return this.each(function() { 
        this.disabled = !b 
    });
};$.fn.selected = function(select) {
    if (select == undefined) select = true;
    return this.each(function() { 
        var t = this.type;
        if (t == 'checkbox' || t == 'radio')
            this.checked = select;
        else if (this.tagName.toLowerCase() == 'option') {
            var $sel = $(this).parent('select');
            if (select && $sel[0] && $sel[0].type == 'select-one') {
                
                $sel.find('option').selected(false);
            }
            this.selected = select;
        }
    });
};function log() {
    if ($.fn.ajaxSubmit.debug && window.console && window.console.log)
        window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,''));
};})(jQuery);if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
