function alertJSVersion(){
	alert('JS Version 001');
}

function printContent(){
    var oWin = window.open();
    oWin.document.write('<HTML><BODY dir="rtl">' + document.getElementById('MainContent').innerHTML + '<CENTER><BR><BR>Look4Love.co.il - אתר ההיכרויות הישראלי</CENTER></BODY></HTML>');
    oWin.document.close();
    oWin.print();
    oWin.close();
}

function showMessagesHistory(cardID, sameWindow){
	var sUrl;
	sUrl = 'messagesHistory.asp?UserID=' + cardID;
	if (sameWindow)
		document.location.href = sUrl;
	else
		openCard(sUrl);
}

function showCard(cardID, sameWindow){
	var sUrl;
	sUrl = 'showCard.asp?UserID=' + cardID;
	if (sameWindow)
		document.location.href = sUrl;
	else
		openCard(sUrl);
}

function showVideo(cardID, sameWindow){
	var sUrl;
	sUrl = 'userVideo.asp?UserID=' + cardID;
	if (sameWindow)
		document.location.href = sUrl;
	else
		openCard(sUrl);
}

function showStory(StoryID, sameWindow){
	var sUrl;
	sUrl = 'showStory.asp?StoryID=' + StoryID;
	if (sameWindow)
		document.location.href = sUrl;
	else
		openCard(sUrl);
}

function showMessage(cardID, MsgID, sameWindow){
	var sUrl;
	sUrl = 'showMessage.asp?UserID=' + cardID + '&msgID=' + MsgID;
	if (sameWindow)
		document.location.href = sUrl;
	else
		openCard(sUrl);
}

function showReportAbuse(cardID, MsgID, sameWindow){
	var sUrl;
	sUrl = 'ReportAbuse.asp?UserID=' + cardID + '&MessageID=' + MsgID;
	if (sameWindow)
		document.location.href = sUrl;
	else
		openCard(sUrl);
}

function showChat(cardID, sameWindow){
	var sUrl;
	sUrl = 'Chat.asp?UserID=' + cardID + '&prm=AutoOpen';
	if (sameWindow)
		document.location.href = sUrl;
	else
		openCard(sUrl);
}

function showSendMessage(cardID, sameWindow){
	var sUrl;
	sUrl = 'SendMessage.asp?UserID=' + cardID;
	if (sameWindow)
		document.location.href = sUrl;
	else
		openCard(sUrl);
}

function openCard(sUrl){
	var sFeatures;
	sFeatures = 'top=0,left=0,width=800,height=' + screen.height + ',scrollbars=yes,resizable=yes,status=yes';
	sFeatures = 'top=0,left=0,height=' + screen.availHeight-20 + ',width=800,scrollbars=yes,resizable=yes,status=yes';

    window.open(sUrl,'',sFeatures);
	//alert(screen.availWidth);
}

function openTellAFriend(emailType, emailID){
	var sUrl;
	var sFeatures;
	sUrl = 'SendEmail.asp?EmailType=' + emailType + '&EmailID=' + emailID;
	sFeatures = 'top=150,left=150,height=250,width=400,scrollbars=yes,resizable=yes,status=yes';

	window.open(sUrl,'',sFeatures);
	//alert(screen.availWidth);
}

function openFromCard(sUrl){
	window.open(sUrl);
	window.close();
}

function openStory(sUrl){
	var sFeatures;
	sFeatures = 'top=0,left=0,width=800,height=' + screen.height + ',scrollbars=yes,resizable=yes,status=yes';
	sFeatures = 'top=0,left=0,height=' + screen.availHeight-20 + ',width=800,scrollbars=yes,resizable=yes,status=yes';

	window.open(sUrl,'ShowStory',sFeatures);
}

function showPicture(pictureName,pictureText){
	var url;
	url = 'ShowPicture.asp?pictureName=' + pictureName + '&pictureText=' + pictureText;
	window.open(url,'','top=50,left=100,hieght=30,width=500,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizeable=yes');
}

function SetSituation(user2, situation){
	//alert(user2 + ' - ' + situation);
	var elm;
	elm = document.getElementById('frmServerSide');
	elm.src = 'ServerSide.asp?Function=SetSituation&user2=' + user2 + '&Situation=' + situation; 
}

function Chat_IgnoreUser(user2){
	var elm;
	elm = document.getElementById('frmServerSide');
	elm.src = 'ServerSide.asp?Function=ChatIgnoreRequest&user2=' + user2; 
}

function jsTrimLines(str){
	var rtnValue;
	rtnValue = str;
	while(rtnValue.indexOf('\r\n') == 0){
		rtnValue = rtnValue.substr(2,rtnValue.length-2)
	}
	while(rtnValue.lastIndexOf('\r\n') == rtnValue.length-2){
		rtnValue = rtnValue.substr(0,rtnValue.length-2)
	}
	
	return rtnValue;
}

function jsShowHideElement(tagName){
	if (document.getElementById(tagName).style.display == 'none'){
		try{
			document.getElementById(tagName).style.display = 'table-row';
		}catch(e){
			document.getElementById(tagName).style.display = 'inline';
		}
	}else{
		document.getElementById(tagName).style.display = 'none';
	}
}

function menu1Over(obj){
    obj.className = 'menu1_On';
    //soundManager.play('MouseOver2');
}

function menu1Out(obj){
    obj.className = 'menu1_Off';
    //alert(selectedMenu + ' - ' + obj.id);
    if (selectedMenu == obj.id)
        obj.className = 'menu1_On';
}

function menu2Over(obj){
    obj.className = 'menu2_On';
    //soundManager.play('MouseOver2');
}

function menu2Out(obj){
    //obj.className = obj.originalclass;
    obj.className = 'menu2_Off';
}

function menu3Over(obj){
    obj.className = 'menu3_On';
    //soundManager.play('MouseOver1');
}

function menu3Out(obj){
    obj.className = 'menu3_Off';
}

function displayMenu2(menuName){
    var show = true;
    var elm = document.getElementById('TR_Menu2_' + menuName);
	if (elm)
	{
	    show = (elm.style.display == 'none')
	    hideAllMenu2();
	    if (show)
	        elm.style.display = 'inline';
	    else
	        elm.style.display = 'none';
	    
	    //soundManager.play('Click1');
	}
    
 /*   
	hideAllMenu2();
	var elm = document.getElementById('TR_Menu2_' + menuName);
	if (elm)
		elm.style.display = 'inline';
*/		
}

function hideAllMenu2(){
	if (document.getElementById('TR_Menu2_WelcomeBack'))
		document.getElementById('TR_Menu2_WelcomeBack').style.display = 'none';
	if (document.getElementById('TR_Menu2_Update'))
		document.getElementById('TR_Menu2_Update').style.display = 'none';
	if (document.getElementById('TR_Menu2_Searches'))
		document.getElementById('TR_Menu2_Searches').style.display = 'none';
	if (document.getElementById('TR_Menu2_Lists'))
		document.getElementById('TR_Menu2_Lists').style.display = 'none';
	if (document.getElementById('TR_Menu2_Messages'))
		document.getElementById('TR_Menu2_Messages').style.display = 'none';
	if (document.getElementById('TR_Menu2_Events'))
		document.getElementById('TR_Menu2_Events').style.display = 'none';
	if (document.getElementById('TR_Menu2_About'))
		document.getElementById('TR_Menu2_About').style.display = 'none';
	if (document.getElementById('TR_Menu2_Admin'))
		document.getElementById('TR_Menu2_Admin').style.display = 'none';
	if (document.getElementById('TR_Menu2_CardMode'))
		document.getElementById('TR_Menu2_CardMode').style.display = 'none';
}


//// ================================================================ ////
//// == Sound Manager Script - Start (from script/soundmanager.js) == ////
//// ================================================================ ////



var isIE = navigator.appName.toLowerCase().indexOf('internet explorer')+1;
var isMac = navigator.appVersion.toLowerCase().indexOf('mac')+1;

function SoundManager(container) {
  // DHTML-controlled sound via Flash
  var self = this;
  this.movies = []; // movie references
  this.container = container;
  this.unsupported = 0; // assumed to be supported
  this.defaultName = 'default'; // default movie
  
  this.FlashObject = function(url) {
    var me = this;
    this.o = null;
    this.loaded = false;
    this.isLoaded = function() {
      if (me.loaded) return true;
      if (!me.o) return false;
      me.loaded = ((typeof(me.o.readyState)!='undefined' && me.o.readyState == 4) || (typeof(me.o.PercentLoaded)!='undefined' && me.o.PercentLoaded() == 100));
      return me.loaded;
    }
    this.mC = document.createElement('div');
    this.mC.className = 'movieContainer';
    with (this.mC.style) {
      // "hide" flash movie
      position = 'absolute';
      left = '-256px';
      width = '64px';
      height = '64px';
    }
    var html = ['<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"><param name="movie" value="'+url+'"><param name="quality" value="high"></object>','<embed src="'+url+'" width="1" height="1" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>'];
    if (navigator.appName.toLowerCase().indexOf('microsoft')+1) {
      this.mC.innerHTML = html[0];
      this.o = this.mC.getElementsByTagName('object')[0];
    } else {
      this.mC.innerHTML = html[1];
      this.o = this.mC.getElementsByTagName('embed')[0];
    }
    document.getElementsByTagName('div')[0].appendChild(this.mC);
  }

  this.addMovie = function(movieName,url) {
    self.movies[movieName] = new self.FlashObject(url);
  }

  this.checkMovie = function(movieName) {
    movieName = movieName||self.defaultName;
    if (!self.movies[movieName]) {
      self.errorHandler('checkMovie','Exception: Could not find movie',arguments);
      return false;
    } else {
      return (self.movies[movieName].isLoaded())?self.movies[movieName]:false;
    }
  }

  this.errorHandler = function(methodName,message,oArguments,e) {
    writeDebug('<div class="error">soundManager.'+methodName+'('+self.getArgs(oArguments)+'): '+message+(e?' ('+e.name+' - '+(e.message||e.description||'no description'):'')+'.'+(e?')':'')+'</div>');
  }

  this.play = function(soundID,loopCount,noDebug,movieName) {
    if (self.unsupported) return false;
    movie = self.checkMovie(movieName);
    if (!movie) return false;
    if (typeof(movie.o.TCallLabel)!='undefined') {
      try {
        self.setVariable(soundID,'loopCount',loopCount||1,movie);
        movie.o.TCallLabel('/'+soundID,'start');
        if (!noDebug) writeDebug('soundManager.play('+self.getArgs(arguments)+')');
      } catch(e) {
        self.errorHandler('play','Failed: Flash unsupported / undefined sound ID (check XML)',arguments,e);
      }
    }
  }

  this.stop = function(soundID,movieName) {
    if (self.unsupported) return false;
    movie = self.checkMovie(movieName);
    if (!movie) return false;
    try {
      movie.o.TCallLabel('/'+soundID,'stop');
      writeDebug('soundManager.stop('+self.getArgs(arguments)+')');
    } catch(e) {
      // Something blew up. Not supported?
      self.errorHandler('stop','Failed: Flash unsupported / undefined sound ID (check XML)',arguments,e);
    }
  }

  this.getArgs = function(params) {
    var x = params?params.length:0;
    if (!x) return '';
    var result = '';
    for (var i=0; i<x; i++) {
      result += (i&&i<x?', ':'')+(params[i].toString().toLowerCase().indexOf('object')+1?typeof(params[i]):params[i]);
    }
    return result
  }

  this.setVariable = function(soundID,property,value,oMovie) {
    // set Flash variables within a specific movie clip
    if (!oMovie) return false;
    try {
      oMovie.o.SetVariable('/'+soundID+':'+property,value);
      // writeDebug('soundManager.setVariable('+self.getArgs(arguments)+')');
    } catch(e) {
      // d'oh
      self.errorHandler('setVariable','Failed',arguments,e);
    }
  }

  this.setVariableExec = function(soundID,fromMethodName,oMovie) {
    try {
      oMovie.o.TCallLabel('/'+soundID,'setVariable');
    } catch(e) {
      self.errorHandler(fromMethodName||'undefined','Failed',arguments,e);
    }
  }

  this.callMethodExec = function(soundID,fromMethodName,oMovie) {
    try {
      oMovie.o.TCallLabel('/'+soundID,'callMethod');
    } catch(e) {
      // Something blew up. Not supported?
      self.errorHandler(fromMethodName||'undefined','Failed',arguments,e);
    }
  }

  this.callMethod = function(soundID,methodName,methodParam,movieName) {
    movie = self.checkMovie(movieName||self.defaultName);
    if (!movie) return false;
    self.setVariable(soundID,'jsProperty',methodName,movie);
    self.setVariable(soundID,'jsPropertyValue',methodParam,movie);
    self.callMethodExec(soundID,methodName,movie);
  }

  this.setPan = function(soundID,pan,movieName) {
    self.callMethod(soundID,'setPan',pan,movieName);
  }

  this.setVolume = function(soundID,volume,movieName) {
    self.callMethod(soundID,'setVolume',volume,movieName);
  }

  // constructor - create flash objects

  if (isIE && isMac) {
    this.unsupported = 1;
  }

  if (!this.unsupported) {
    this.addMovie(this.defaultName,'soundcontroller.swf');
    // this.addMovie('rc','rubber-chicken-audio.swf');
  }

}

function SoundManagerNull() {
  // Null object for unsupported case
  this.movies = []; // movie references
  this.container = null;
  this.unsupported = 1;
  this.FlashObject = function(url) {}
  this.addMovie = function(name,url) {}
  this.play = function(movieName,soundID) {
    return false;
  }
  this.defaultName = 'default';
}

function writeDebug(msg) {
  var o = document.getElementById('debugContainer');
  if (!o) return false;
  var d = document.createElement('div');
  d.innerHTML = msg;
  o.appendChild(d);
}

var soundManager = null;

function soundManagerInit() {
  soundManager = new SoundManager();
}

//// ================================================================ ////
//// == Sound Manager Script - End   (from script/soundmanager.js) == ////
//// ================================================================ ////





//// ================================================================ ////
//// == Menu MPopup Script - Start                                 == ////
//// ================================================================ ////


// Copyright (C) 2005-2008 Ilya S. Lyubinskiy. All rights reserved.
// Technical support: http://www.php-development.ru/
//
// YOU MAY NOT
// (1) Remove or modify this copyright notice.
// (2) Re-distribute this code or any part of it.
//     Instead, you may link to the homepage of this code:
//     http://www.php-development.ru/javascripts/dropdown.php
//
// YOU MAY
// (1) Use this code on your website.
// (2) Use this code as part of another product.
//
// NO WARRANTY
// This code is provided "as is" without warranty of any kind.
// You expressly acknowledge and agree that use of this code is at your own risk.


// ***** Popup Control *********************************************************

// ***** at_show_aux *****

function at_show_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child );

//  var top  = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
//  var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;
  var top  = (c["at_position"] == "y") ? p.offsetHeight : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth : 0;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  c.style.top        = top +'px';
  c.style.left       = left+'px';
  c.style.visibility = "visible";
}

// ***** at_show *****

function at_show()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  at_show_aux(p.id, c.id);
  clearTimeout(c["at_timeout"]);
}

// ***** at_hide *****

function at_hide()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 10);
}

// ***** at_click *****

function at_click()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  if (c.style.visibility != "visible") at_show_aux(p.id, c.id); else c.style.visibility = "hidden";
  return false;
}

// ***** at_attach *****

// PARAMETERS:
// parent   - id of the parent html element
// child    - id of the child  html element that should be droped down
// showtype - "click" = drop down child html element on mouse click
//            "hover" = drop down child html element on mouse over
// position - "x" = display the child html element to the right
//            "y" = display the child html element below
// cursor   - omit to use default cursor or specify CSS cursor name

function at_attach(parent, child, showtype, position, cursor)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);

  p["at_parent"]     = p.id;
  c["at_parent"]     = p.id;
  p["at_child"]      = c.id;
  c["at_child"]      = c.id;
  p["at_position"]   = position;
  c["at_position"]   = position;

  c.style.position   = "absolute";
  c.style.visibility = "hidden";

  if (cursor != undefined) p.style.cursor = cursor;

  switch (showtype)
  {
    case "click":
      p.onclick     = at_click;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
    case "hover":
      p.onmouseover = at_show;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
  }
}

//// ================================================================ ////
//// == Menu MPopup Script - End                                   == ////
//// ================================================================ ////



//// ================================================================ ////
//// == Type Writer Script - Start                                 == ////
//// ================================================================ ////

var twCcontent = "";

function twDisplayTW() {twDisplay('tw',twCcontent,0);}
loaded('tw',twDisplayTW);

var brk = '~'; // character to use for line break
var resetTime = 0; // set to 0 to not reset or seconds to delay before reset

// Typewriter Text Javascript
// copyright 13th October, 2007 by Stephen Chapman
// permission to use this Javascript on your web page is granted
// provided that all of the code in this script (including these
// comments) is used without any alteration
// you can change the values above this notice to suit your requirements
function twDisplay(id,content,num) {var delay = 140; if (num <= content.length)  {var lt = content.substr(0,num); document.getElementById(id).innerHTML = lt.replace(RegExp(brk,'g'),'<br \/>'); num++; if (num > content.length) delay = resetTime * 1000;} else {document.getElementById(id).innerHTML = ''; num = 0;} if (delay > 0) setTimeout('twDisplay("'+id+'","'+content+'","'+num+'")',delay);} var pageLoaded = 0; window.onload = function() {pageLoaded = 1;}; function loaded(i,f) {if (document.getElementById && document.getElementById(i) != null) f(); else if (!pageLoaded) setTimeout('loaded(\''+i+'\','+f+')',100);}

//// ================================================================ ////
//// == Type Writer Script - End                                   == ////
//// ================================================================ ////
