var obj_id = "rating1685";

var flash_obj = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
flash_obj = flash_obj + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
flash_obj = flash_obj + 'width="75" ';
flash_obj = flash_obj + 'height="15" ';
flash_obj = flash_obj + 'id="ratingFlash" ';
flash_obj = flash_obj + 'align="middle">';
flash_obj = flash_obj + '<param name="allowScriptAccess" value="sameDomain" />';
flash_obj = flash_obj + '<param name="movie" value="http://www.knowledgestream.org/modules/review/rating_v3.swf?rating=0&amp;tag=rating1685&amp;itemid=1685&amp;userid=&amp;yours=0&amp;color=FFB211" />';
flash_obj = flash_obj + '<param name="quality" value="high" />';
flash_obj = flash_obj + '<param name="bgcolor" value="#ffffff" />';
flash_obj = flash_obj + '<param name="wmode" value="transparent" />';
flash_obj = flash_obj + '<param name="scale" value="default" />';
flash_obj = flash_obj + '<param name="swliveconnect" value="true" />';
flash_obj = flash_obj + '<embed src="http://www.knowledgestream.org/modules/review/rating_v3.swf?rating=0&amp;tag=rating1685&amp;itemid=1685&amp;userid=&amp;yours=0&amp;color=FFB211" ';
flash_obj = flash_obj + 'quality="high" ';
flash_obj = flash_obj + 'bgcolor="#ffffff" ';
flash_obj = flash_obj + 'width="75" ';
flash_obj = flash_obj + 'height="15" ';
flash_obj = flash_obj + 'name="ratingFlash" ';
flash_obj = flash_obj + 'wmode="transparent" ';
flash_obj = flash_obj + 'scale="default" ';
flash_obj = flash_obj + 'align="middle" ';
flash_obj = flash_obj + 'allowScriptAccess="sameDomain" ';
flash_obj = flash_obj + 'type="application/x-shockwave-flash" ';
flash_obj = flash_obj + 'pluginspage="http://www.macromedia.com/go/getflashplayer" ';
flash_obj = flash_obj + 'swliveconnect="true" />';
flash_obj = flash_obj + '</object>';

var round_rating = Math.round(0);
var my_rating = '0';
var user = '';


var itsfullofstars = '';
var link = '';

for (i=1;i<=5;i++) {
	var nouser = "login_popup('submitreview(\\'rating\\', "+i+", \\'rating1685\\', \\'rating1685\\', \\'1685\\')');";
	var usernorating = "submitreview('rating', "+i+", 'rating1685', 'rating1685', '1685');"
	var userrating = "alert('You have already rated this item');"
	
	if(user > 0) {
		if(my_rating > 0){
			link = userrating;
		}else{
			link = usernorating;
		}
	}else{
		link = nouser;
	}
	
	var grey_star = '<img src="http://www.knowledgestream.org/modules/review/greystar.png" width="14" height="14" alt="" border="0" onclick="' + link + '"/>';
var blue_star = '<img src="http://www.knowledgestream.org/modules/review/bluestar.png" width="14" height="14" alt="" border="0" onclick="' + link + '"/>';
	
	if(i <= round_rating){
		itsfullofstars = itsfullofstars + '<a href="javascript:' + link + '" style="width:14px;height:14px;">' + blue_star + '</a>';
	}else{
		itsfullofstars = itsfullofstars + '<a href="javascript:' + link + '" style="width:14px;height:14px;">' + grey_star + '</a>';
	}
}

var monolith = '<div id="ratingNonFlash" style="width:75px;height:15px;">' + itsfullofstars + '</div>';

var non_flash_obj = monolith;

if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))){
	document.getElementById(obj_id).innerHTML = non_flash_obj;
} else {
	//alert(non_flash_obj);
	//document.getElementById(obj_id).innerHTML = non_flash_obj;
	document.getElementById(obj_id).innerHTML = flash_obj;
}