	function sendFriends(gameid)
	{
		window.open("sendFriends.php?gameid="+gameid ,"sendFriends","titlelocation=0,status=0,scrollbars=0,width=650,height=550"); 
	} 

	function snag(gameid)
	{
		window.open("snag.php?gameid="+gameid ,"snag","titlelocation=0,status=0,scrollbars=0,width=650,height=550"); 
	} 
// Inheritance 
Object.prototype.extend = function(vSuper) {
	oSuper = (typeof(vSuper) == 'string') ? eval('new '+vSuper+'()') : vSuper; 
	for (sProperty in oSuper) { 
		this[sProperty] = oSuper[sProperty]; 
	} 
	delete(oSuper); 
}; 

// Add a method
Object.prototype.method = function(name, func){
	this.prototype[name] = func;
  return this;
}

// Add a property, getter, and setter
Object.prototype.addProperty = function (sType, sName, vValue) { 
	if (sType != '' && sType != null && typeof(vValue) != sType) { 
		alert('Property ' + sName + ' must be of type ' + sType + ', was ' + typeof(vValue) + '.'); 
	} 

	this[sName] = vValue; 
  
	var sFuncName = sName.charAt(0).toUpperCase() + sName.substring(1, sName.length); 

	this['get' + sFuncName] = function () { return this[sName] }; 
	this['set' + sFuncName] = function (vNewValue) { 
		if (sType != '' && sType != null && typeof(vNewValue) != sType) { 
			alert('Property ' + sName + ' must be of type ' + sType + ', was ' + typeof(vValue) + '.'); 
		} 
		this[sName] = vNewValue; 
	};
}


var CONST_NUM_STARS = 5;

/* Jason's */
var CONST_OFF_STAR ="imagenes/star-border.gif";
var CONST_RATED_OFF_STAR = CONST_OFF_STAR;
var CONST_UNRATED_STAR = CONST_OFF_STAR;
var CONST_ON_STAR = "imagenes/star-filled.gif";
var CONST_RATED_ON_STAR = "imagenes/star-over.gif";
var CONST_ROLLOVER_STAR = CONST_RATED_ON_STAR;


/*
var CONST_OFF_STAR ="http://dyn.ifilm.com/image/i/2/stars/star_off.gif";
var CONST_ON_STAR = "http://dyn.ifilm.com/image/i/2/stars/star_on.gif";
var CONST_ROLLOVER_STAR = "http://dyn.ifilm.com/image/i/2/stars/star_over.gif";
var CONST_RATED_OFF_STAR = "http://dyn.ifilm.com/image/i/2/stars/star_rated-off.gif";
var CONST_RATED_ON_STAR = "http://dyn.ifilm.com/image/i/2/stars/star_rated-on.gif";
var CONST_UNRATED_STAR = "http://dyn.ifilm.com/image/i/2/stars/star_unrated.gif";
*/

function doNothing(html){
}

function UserRating(id, rating){
	this.addProperty("number", "id", id);
	this.addProperty("number", "baseRating", rating);
	this.addProperty("number", "userRating", 0);
	this.addProperty("boolean", "rated", false);
	with(UserRating){
		method("setRollout", function(){
			if(this.getRated()){
				return;
			}
			this.setVisualState(this.getBaseRating(), CONST_ON_STAR, CONST_OFF_STAR);
		});
		method("setRollover", function(num){
			if(this.getRated()){
				return;
			}
			this.setVisualState(num, CONST_ROLLOVER_STAR, CONST_OFF_STAR);
		});
		method("setUserRated", function(num){
			this.setUserRating(num);
			this.setRated(true);
			this.setVisualState(this.getUserRating(), CONST_RATED_ON_STAR, CONST_RATED_OFF_STAR);
		    var url='rating='+num+'&ifilmId='+this.getId();
		   // callToServer('/recordRating', url, 'doNothing');
		   // document.getElementById('textRatingDiv_' + this.getId()).innerHTML = "&nbsp;&nbsp;Thank you.";
		});
		method("getStar", function(num){
			return document.getElementById('ratingStar-' + this.getId() + '-' + num);
		});
		method("setVisualState", function(num, stateOn, stateOff){
			for(var x = 1; x <= CONST_NUM_STARS; ++x){
				if(x <= num){
					this.getStar(x).src = stateOn;
				}else{
					this.getStar(x).src = stateOff;					
				}
			}						
		});
		
	}
}


function PlayingUserRating(id, rating){
	this.addProperty("number", "id", id);
	this.addProperty("number", "baseRating", rating);
	this.addProperty("number", "userRating", 0);
	this.addProperty("boolean", "rated", false);
	with(PlayingUserRating){
		method("setRollout", function(){
			if(this.getRated()){
				return;
			}
			this.setVisualState(this.getBaseRating(), CONST_ON_STAR, CONST_OFF_STAR);
		});
		method("setRollover", function(num){
			if(this.getRated()){
				return;
			}
			this.setVisualState(num, CONST_ROLLOVER_STAR, CONST_OFF_STAR);
		});
		method("setUserRated", function(num){
			this.setUserRating(num);
			this.setRated(true);
			this.setVisualState(this.getUserRating(), CONST_RATED_ON_STAR, CONST_RATED_OFF_STAR);
		    var url='rating='+num+'&ifilmId='+this.getId();
		});
		method("getStar", function(num){
			return document.getElementById('pratingStar-' + this.getId() + '-' + num);
		});
		method("setVisualState", function(num, stateOn, stateOff){
			for(var x = 1; x <= CONST_NUM_STARS; ++x){
				if(x <= num){
					this.getStar(x).src = stateOn;
				}else{
					this.getStar(x).src = stateOff;					
				}
			}						
		});
		
	}
}


function FeaturedGameRating(id, rating){
	this.addProperty("number", "id", id);
	this.addProperty("number", "baseRating", rating);
	this.addProperty("number", "userRating", 0);
	this.addProperty("boolean", "rated", false);
	with(FeaturedGameRating){
		method("setRollout", function(){
			if(this.getRated()){
				return;
			}
			this.setVisualState(this.getBaseRating(), CONST_ON_STAR, CONST_OFF_STAR);
		});
		method("setRollover", function(num){
			if(this.getRated()){
				return;
			}
			this.setVisualState(num, CONST_ROLLOVER_STAR, CONST_OFF_STAR);
		});
		method("setUserRated", function(num){
			this.setUserRating(num);
			this.setRated(true);
			this.setVisualState(this.getUserRating(), CONST_RATED_ON_STAR, CONST_RATED_OFF_STAR);
		    var url='rating='+num+'&ifilmId='+this.getId();
		});
		method("getStar", function(num){
			return document.getElementById('FeaturedGameRatingStar-' + this.getId() + '-' + num);
		});
		method("setVisualState", function(num, stateOn, stateOff){
			for(var x = 1; x <= CONST_NUM_STARS; ++x){
				if(x <= num){
					this.getStar(x).src = stateOn;
				}else{
					this.getStar(x).src = stateOff;					
				}
			}						
		});
		
	}
}


function PopularGameRating(id, rating){
	this.addProperty("number", "id", id);
	this.addProperty("number", "baseRating", rating);
	this.addProperty("number", "userRating", 0);
	this.addProperty("boolean", "rated", false);
	with(PopularGameRating){
		method("setRollout", function(){
			if(this.getRated()){
				return;
			}
			this.setVisualState(this.getBaseRating(), CONST_ON_STAR, CONST_OFF_STAR);
		});
		method("setRollover", function(num){
			if(this.getRated()){
				return;
			}
			this.setVisualState(num, CONST_ROLLOVER_STAR, CONST_OFF_STAR);
		});
		method("setUserRated", function(num){
			this.setUserRating(num);
			this.setRated(true);
			this.setVisualState(this.getUserRating(), CONST_RATED_ON_STAR, CONST_RATED_OFF_STAR);
		    var url='rating='+num+'&ifilmId='+this.getId();
		});
		method("getStar", function(num){
			return document.getElementById('PopularGameRatingStar-' + this.getId() + '-' + num);
		});
		method("setVisualState", function(num, stateOn, stateOff){
			for(var x = 1; x <= CONST_NUM_STARS; ++x){
				if(x <= num){
					this.getStar(x).src = stateOn;
				}else{
					this.getStar(x).src = stateOff;					
				}
			}						
		});
		
	}
}




function UnratedUserRating(id){
	this.extend(new UserRating(id, 0));
	with(UserRating){
	this.setRollout= function(){
			if(this.getRated()){
				return;
			}
			this.setVisualState(CONST_NUM_STARS, CONST_UNRATED_STAR, CONST_UNRATED_STAR);
		};
	}
}


function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}
