LightboxOptions = Object.extend({
    fileLoadingImage:        _host + 'img/loading.gif',
    fileBottomNavCloseImage: _host + 'img/closelabel.png',
    overlayOpacity: 0.8,   // controls transparency of shadow overlay
    animate: true,         // toggles resizing animations
    resizeSpeed: 7,        // controls the speed of the image resizing animations (1=slowest and 10=fastest)
    borderSize: 10,         //if you adjust the padding in the CSS, you will need to update this variable
		labelImage: "Image",
		labelOf: "of"
}, window.LightboxOptions || {});

document.observe("dom:loaded", function() {
    new Lightbox();
    
	$$("#submit_article_review_form input, #submit_article_review_form textarea").each( function(input) {
		new Tooltip(input, {backgroundColor: "#FC9", borderColor: "#C96", 
		textColor: "#000", textShadowColor: "#FFF"});
	});

	if(_type == 1) {
		
		/** mediaspace1 **/
		swfobject.embedSWF(_host+"mini_player/flvplayer.swf","mediaspace1","247","206","8.0.0","expressInstall.swf", 
			{
				themes:_host+"elite_video/themes_largewhite.xml", 
				flv:_us_host+"files/videos/companies/"+_clip,
				config:_host+"mini_player/skin/config3.php?host="+_host+"&video_url="+_us_host+'files/videos/companies/'+_clip,
				showarrow:"false", showlayer:"false",
				autoplay:"false", enablejs:"true"
			}, 
			{allowfullscreen:"true", wmode:"opaque", quality:"high", allowscriptaccess:"always"});
	
	} else if(_type == 2) {
	
		/** mediaspace1 **/
		swfobject.embedSWF(_host+"mini_player/flvplayer.swf","mediaspace1","247","206","8.0.0","expressInstall.swf", 
			{
				themes:_host+"elite_video/themes_largewhite.xml", 
				flv:_us_host+"files/videos/companies/"+_clip,
				config:_host+"mini_player/skin/config2.php?host="+_host,
				vimage:_us_host+'files/videos/companies/company-video_comingsoon.jpg',
				showarrow:"false", showlayer:"false",
				autoplay:"false", enablejs:"true"
			}, 
			{allowfullscreen:"true", wmode:"opaque", quality:"high", allowscriptaccess:"always"});
			
	}
	
    if($('more_reviews') != null) {
	    $('more_reviews').observe("click", function() {
    	    $('more_reviews_p').update('Loading...');
    	    new Ajax.Request(_host + 'Company/loadReview/' + $('more_reviews_id').value, { 
        		method: 'get', 
        		onSuccess: function(transport) { 
        		    $('more_reviews_p').remove();
        		    $('article_review').insert(transport.responseText, { position: 'bottom' });
        		} 
        	});
    	});
	}
});

function validate_creview_form() {
	var f = $('submit_article_review_form');
	if(f.rtg.value == 0 ){
		alert("Please rate this Company.");
	  return false;
	}else if(f.name.value==""){
	 	alert("Please Enter Your Name.");
	  f.name.focus();
	 	return false;
	}else if(f.title.value==""){
	 	alert("Please Enter Summary.");
	  f.title.focus();
	 	return false;
	}else if(f.description.value==""){
	 	alert("Please Enter Review.");
	  f.description.focus();
	 	return false;
	}else if(f.email.value==""){
	 	alert("Please Enter the Email.");
	  f.email.focus();
	 	return false;
	}else if(!email(f.email.value)){
	  alert("Please Enter Valid Email.");
	  f.email.focus();
	 	return false;
	}else{
		return true;
	}
	return true;
}

function submitReview() {
	location.reload(true);
}

function offensiveFlag(rowid, valid, updateid) {
	URL = _host + 'Company/Flag/'+rowid+'/'+valid;
	new Ajax.Request(URL, { 
		method: 'get', 
		onSuccess: function(transport) { 
			$(updateid).update(transport.responseText);
		} 
	});
}

function sendForm() {
	URL = _host + 'Company/saveRating';
	new Ajax.Request(URL, { 
		method: 'post', 
		parameters: Form.serialize($('submit_article_review_form')), 
		onSuccess: function(transport) { 
			//$(updateid).update(transport.responseText);
		} 
	});
	return true;
}
