
function isFunction(fn){ return typeof(fn)=='function'&&(!Function.prototype.call||typeof(fn.call)=='function'); }
function isElement(e){ return e&&typeof(e)=='object'&&e.nodeType==1&&e.constructor==document.createElement(e.nodeName).constructor; }

function popup_ajax(file,width,onComplete){
 popup('<div style="text-align:center;padding:50px 0px 80px;"><img src="../images/popup/loading.gif" /></div>',width);
 jQuery('#popupmsg').load(file,'',onComplete);
 //if(typeof(onComplete)=='string'||isFunction(onComplete)) setTimeout(onComplete,10);
 }

function popup(content,width){
 var width = (typeof(width)=='undefined' ? 274 : width );
 var innerhtml = ( isElement(content) ? content.innerHTML : content );
 
 if(document.getElementById('popup')){ closepopup(); }
 
 html = ''
 +'<div id="popup">'
 +'<div id="popupbgnd" onclick="closepopup();"></div>'
 +'<table><tr><td>'
 +'<div id="popupmsg" style="width:'+width+'px;">'
 +'<div id="popupclose" onclick="closepopup();"></div>'
 +innerhtml
 +'</div>'
 +'</td></tr></table>'
 +'</div>';
 jQuery(document.body).append(html);
 
 //jQuery('#characters').css({'display':'none'});
 
 if(jQuery.browser.msie && jQuery.browser.version.substr(0,1)<7){ jQuery(window).bind('scroll',ie6_adjustpopupposition); }
 }
function closepopup(){
 var e = document.getElementById('popup');
 e.parentNode.removeChild(e);
 jQuery('#characters').css({'display':''});
 if(jQuery.browser.msie && jQuery.browser.version.substr(0,1)<7){ jQuery(window).unbind('scroll',ie6_adjustpopupposition); }
 }

function ie6_adjustpopupposition(event){
 if(!document.getElementById('popup')){ jQuery(window).unbind('scroll',ie6_adjustpopupposition);}
 else{ document.getElementById('popup').style.top = document.body.parentElement.scrollTop; }
 }


function openvideo(src,w,h){

 popup( '<div id="flashvideocontainer" style="text-align:center;"><a href="http://www.adobe.com/products/flashplayer/" target="_new" id="noflashbanner"><img src="../images/tvads/118tvads-noflash.png" style="margin:40px 0px;" /></a></div>'
 ,w );
 
 jQuery('#popupmsg').addClass('popupmsg-style2');
 jQuery('#popupclose').addClass('popupclose-style2');
 
 var flashvars = {};
 flashvars.videoPath = "../../"+src;
 flashvars.imagePath = src+'.jpg';
 flashvars.stageW = w;
 flashvars.stageH = h;

 flashvars.autoStart = "true";
 flashvars.autoHide = "true";
 flashvars.autoHideTime = "3";
 flashvars.hideLogo = "true";

 flashvars.volAudio = "100";
 flashvars.disableMiddleButton = "false";
 flashvars.playSounds = "false";
 
 flashvars.soundBarColor = "0xCC0000";
 flashvars.barColor = "0xCC0000";
 flashvars.barShadowColor = "0xAAAAAA";
 flashvars.subbarColor = "0xFFFFFF";
 
 flashvars.extendVideo = "true";

 var params = {};
 params.bgcolor = "#000000";
 //params.wmode = "transparent";
 params.allowFullScreen = "true";
 params.allowScriptAccess = "sameDomain";
 
 var attributes = {};

 swfobject.embedSWF("../swf/flvPlayer.swf", "flashvideocontainer", w, h, "9.0.0", "", flashvars, params, attributes);

}

function initRatingSlider(){
 smallSlider = new slider(
		{
		's_form' : 'submit_a_review_form',
		's_name': 'rating0',
		'n_minValue' : 1,
		'n_maxValue' : 5,
		'n_value' : 3,
		'n_step' : 1
		}
		,
		{
		'b_vertical' : false,
		'b_watch': true,
		'n_controlWidth': 132,
		'n_controlHeight': 13,
		'n_sliderWidth': 15,
		'n_sliderHeight': 13,
		'n_pathLeft' : 0,
		'n_pathTop' : 0,
		'n_pathLength' : 117,
		's_imgControl': '../images/popup/bar.png',
		's_imgSlider': '../images/popup/slider.png',
		'n_zIndex': 255
		}
		);
}

