function SelectAll(id)
{
    document.getElementById(id).focus();
    document.getElementById(id).select();
}

function ezinesubmit()
{
	var emailvalue = document.forms[0].cpSys_Html_Form_email_address_savicom.value;
	var termsaccept = document.forms[0].cpSys_Html_Form_termsaccept.checked; 
	if (emailvalue.indexOf('@') > 1 && termsaccept == 1) {
		window.location='http://i.ms00.net/subscribe?list=RaganNewsstand&msgid=_MSGID_&redirect=http://208.66.171.149/Main/ThankyouManageBetterezine.aspx&sublist=7&subscribe_button_name=Join&server_action:subscribe=Sign%20up&email_address=' + emailvalue;
	} else {
		if (termsaccept != 1) {
			alert('Please accept terms of use.');
		} else {
			alert('Please enter your e-mail.');
		}
	}
	return false;
}

$(function () {



function test_mobi() {
	var test_mobile=false;

	if (/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))) test_mobile=true;

	video_type = "flash";

	if((navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPad/i))) video_type = "html5"; else if(test_mobile) video_type = "directlink";

	return video_type;

}


	if ($("#usrnm").html().length > 0) {
        var var_usrnm = $("#usrnm").html();
        if (var_usrnm.length > 3) {
            $('.left_box_abstract').attr("style", "display:none;");
            $('#topnav_fbconnect_link').attr("style", "display:none;");
        }
		var var_usrr = $("#usrar").html();
		
		//59ea1eec-dc7b-41e9-8d22-0d8d3c6bad90, c2a48a84-11e4-4311-a5c3-117dd89adbfd, 369b2c93-5adc-447d-b3bd-26f3dbc4a139, 452627be-ecd6-4f87-97b9-2e06dd823a72, 325255ba-6a5c-44c3-928d-5161c85c6ccb, 65dacfc9-1515-4619-9531-a5b770dd170b, 3eada073-fc8b-4d1a-941d-efd1d3542a4b
		
		if ((var_usrr.indexOf("369b2c93-5adc-447d-b3bd-26f3dbc4a139") > -1) || (var_usrr.indexOf("5eb18524-e7a4-4596-ba00-dfcc957cc18a") > -1) || (var_usrr.indexOf("452627be-ecd6-4f87-97b9-2e06dd823a72") > -1) || (var_usrr.indexOf("59ea1eec-dc7b-41e9-8d22-0d8d3c6bad90") > -1) || (var_usrr.indexOf("325255ba-6a5c-44c3-928d-5161c85c6ccb") > -1) || (var_usrr.indexOf("c2a48a84-11e4-4311-a5c3-117dd89adbfd") > -1) || (var_usrr.indexOf("65dacfc9-1515-4619-9531-a5b770dd170b") > -1) ||(var_usrr.indexOf("3eada073-fc8b-4d1a-941d-efd1d3542a4b") > -1)) {
            $('.b369b2c93').removeClass();
            $('.a369b2c93').removeClass();
            $('.a5eb18524').removeClass();
            $('.b5eb18524').removeClass();
            $('.a452627be').removeClass();
            $('.b452627be').removeClass();
            $('.a59ea1eec').removeClass();
            $('.b59ea1eec').removeClass();
            $('.ac2a48a84').removeClass();
            $('.bc2a48a84').removeClass();
            $('.a65dacfc9').removeClass();
            $('.b65dacfc9').removeClass();
            $('.a325255ba').removeClass();
            $('.b325255ba').removeClass();
			$('.a3eada073').removeClass();
			$('.b3eada073').removeClass();
			
			$('#topnav_spaceformembercenter').html('<a href="https://www.qfie.com/ragan2/clsRAGANLookup.asp?strAspReason=101&SiteID=&AudID=AA83ED248A3241A5AE080E2B6DED1F5F">My Account</a> | ');
            if (window.location.pathname.indexOf('/Main/')>-1) $('#topnav_spaceformembercenter').html('<a href="/Main/Members.aspx">Member Center</a> | ');
  		    if (window.location.pathname.indexOf('/FirstDraft/') > -1) $('#topnav_spaceformembercenter').html('<a href="https://www.qfie.com/ragan2/clsRAGANLookup.asp?strAspReason=101&AudID=AA83ED248A3241A5AE080E2B6DED1F5F">My Account</a> | ');
			if (window.location.pathname.indexOf('/CommunicationSolutions/')>-1) $('#topnav_spaceformembercenter').html('<a href="/CommunicationSolutions/Members.aspx">Member Center</a> | ');
			if (window.location.pathname.indexOf('/TheManagersIntelligenceReport/')>-1) $('#topnav_spaceformembercenter').html('<a href="/TheManagersIntelligenceReport/Members.aspx">Member Center</a> | ');
			if (window.location.pathname.indexOf('/EmployeeRecruitmentRetention/')>-1) $('#topnav_spaceformembercenter').html('<a href="/EmployeeRecruitmentRetention/Members.aspx">Member Center</a> | ');
			if (window.location.pathname.indexOf('/LeadingforResults/')>-1) $('#topnav_spaceformembercenter').html('<a href="/LeadingforResults/Members.aspx">Member Center</a> | ');

    }
	}
    /*Mixing video vith articles*/
   /* if ($('#video_box_full').html()) {
        var videbox = '<div id="video_box_full">' + $('#video_box_full').html() + '</div>';
        $('#video_box_full').remove();
        $('.topic_article_list').eq(1).after(videbox);
    }*/

    /*Date part*/

    var current_date = new Date();

    var month_names = new Array();
    month_names[month_names.length] = "January";
    month_names[month_names.length] = "February";
    month_names[month_names.length] = "March";
    month_names[month_names.length] = "April";
    month_names[month_names.length] = "May";
    month_names[month_names.length] = "June";
    month_names[month_names.length] = "July";
    month_names[month_names.length] = "August";
    month_names[month_names.length] = "September";
    month_names[month_names.length] = "October";
    month_names[month_names.length] = "November";
    month_names[month_names.length] = "December";

    var day_names = new Array();
    day_names[day_names.length] = "Sunday";
    day_names[day_names.length] = "Monday";
    day_names[day_names.length] = "Tuesday";
    day_names[day_names.length] = "Wednesday";
    day_names[day_names.length] = "Thursday";
    day_names[day_names.length] = "Friday";
    day_names[day_names.length] = "Saturday";

    currentDate_value = day_names[current_date.getDay()] + ", " + month_names[current_date.getMonth()] + " " + current_date.getDate() + ", " + current_date.getFullYear();

    $('#todays_date').html(currentDate_value);


    /*Selected page */
   /* var path = location.pathname.substring(1).split('/');
    select_atag_value = '#' + path[0].toLowerCase();
    $(select_atag_value).attr('class', 'a_nav_selected a_nav_links');*/
	
	var path = location.pathname.toLowerCase();
	if (path.indexOf("video") != -1) {
		$('#main').attr('class', 'a_nav_links');
		$('#Video_nav').attr('class', 'a_nav_selected a_nav_links');
	}
	
	if (path.indexOf("editors") != -1 || location.search.indexOf("authorid") != -1) {
		$('#main').attr('class', 'a_nav_links');
		$('#Contributors').attr('class', 'a_nav_selected a_nav_links');
	}

    /*Moved here because there were conflicts with facebook like in IE8*/

    if ($('.sc_retweet_list').length) {
        var i_count_reseet = 0;
        /*var timevar_object = new Date();*/
        $('.sc_retweet_list').each(function () {
            /*timevar = timevar_object.getTime();*/
            i_count_reseet++;
            tweetmeme_style = 'compact';
            tweetmeme_source = 'MarkRaganCEO';
            tweetmeme_service = 'bit.ly';
            //  alert($(this).attr("layout"));
            if ($(this).attr("retweetlink")) { tweetmeme_url = $(this).attr("retweetlink").replace(":", "%3A"); } else { tweetmeme_url = location.href.replace(":", "%3A"); }
            if ($(this).attr("alt_retweetlink")) { if ($(this).attr("alt_retweetlink") != '') { tweetmeme_url = $(this).attr("alt_retweetlink").replace(":", "%3A"); } }

            $(this).append('');
            $(this).append('<iframe scrolling="no" height="25" frameborder="0" width="90" src="http://api.tweetmeme.com/button.js?url=' + tweetmeme_url + '&amp;style=' + tweetmeme_style + '&amp;source=' + tweetmeme_source + '&amp;service=' + tweetmeme_service + '&amp;b=1' + '"></iframe>');
        });
    }


    if ($('.comments_count table tbody tr td div').length) {
        var total_comments_on_page = $('.comments_count table tbody tr td div').html();
        $('.comments_count').replaceWith(' | <span class="articles_top_comments">' + total_comments_on_page + ' Comments</span>');
        $('.comments_count2').append(total_comments_on_page);
    }
    if ($('.sc_facebook_like').length) {
        counter_for_facebook_like = 10;
        var iframe_content = "";
        /*var timevar_object = new Date();*/
        $(".sc_facebook_like").each(function () {
            /*timevar = timevar_object.getTime();*/
            //  alert($(this).attr("layout"));
            if ($(this).attr("fblink")) { linkforfacebook = escape($(this).attr("fblink")); } else { linkforfacebook = escape(location.href); }
            if ($(this).attr("fbheight")) { heightforfacebook = $(this).attr("fbheight"); } else { heightforfacebook = 65; }
            /*alt_fblink*/
            if ($(this).attr("alt_fblink")) { if ($(this).attr("alt_fblink") != '') { linkforfacebook = escape($(this).attr("alt_fblink")); } }
            $(this).append('');
            iframe_content = '<iframe src="http://www.facebook.com/plugins/like.php?href=' + linkforfacebook + '&amp;layout=' + $(this).attr("layout") + '&amp;show_faces=true&amp;width=' + $(this).attr("fbwidth") + '&amp;action=like&amp;colorscheme=light&amp;height=' + heightforfacebook + '" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:' + $(this).attr("fbwidth") + 'px; height:' + heightforfacebook + 'px;" allowTransparency="true"></iframe>';
            $(this).append(iframe_content);
        });
    }

    /*if ($('.dynamic_content_add')) {
        $('.dynamic_content_add').each(function () {
            var tmp_javascript_autonumber = $(this).attr('autonumber');
            var tmp_javascript_str = document.createElement('script');
            tmp_javascript_str.src = 'http://web.ragan.com/comments/rss/jsservice.php?anumb='+tmp_javascript_autonumber;
            tmp_javascript_str.type = 'text/javascript';
            document.getElementById(tmp_javascript_autonumber).appendChild(tmp_javascript_str);
            /*$(this).append(tmp_javascript_str);
        });
    }*/

    if ($('.sc_tweetememe').length) {
        var temp_url=location.href;
		temp_url=temp_url.toLowerCase();
		if (temp_url.indexOf("tomorrow") <=0) {
			$('.sc_tweetememe').each(function () {
				tweetmeme_style = 'normal';
				tweetmeme_source = 'MarkRaganCEO';
				tweetmeme_service = 'bit.ly';
				tweetmeme_url_temp = location.href.split('#')[0];
				tweetmeme_url_temp_prefix = 'http://208.66.171.149/Main/Articles/';
				if (tweetmeme_url_temp.split('/')[4].toLowerCase() == 'video') { tweetmeme_url_temp_prefix = 'http://208.66.171.149/Main/Video/'; }
				tweetmeme_url_temp = tweetmeme_url_temp_prefix + tweetmeme_url_temp.split('/')[5];
				tweetmeme_url = tweetmeme_url_temp.replace(":", "%3A");
				if ($(this).attr("retweetlink")) { tweetmeme_url = $(this).attr("retweetlink").replace(":", "%3A"); }
				if ($(this).attr("alt_retweetlink")) { if ($(this).attr("alt_retweetlink") != '') { tweetmeme_url = $(this).attr("alt_retweetlink").replace(":", "%3A"); } }
				$(this).append('<iframe scrolling="no" width="50" height="61" frameborder="0" src="http://api.tweetmeme.com/button.js?url=' + tweetmeme_url + '&amp;style=' + tweetmeme_style + '&amp;source= ' + tweetmeme_source + ' &amp;service=' + tweetmeme_service + '&amp;b=1"></iframe>');
			});
		}
    }

	 if ($('.sc_tweetememe_comp').length) {
        var temp_url=location.href;
		temp_url=temp_url.toLowerCase();
		if (temp_url.indexOf("tomorrow") <=0) {
			$('.sc_tweetememe_comp').each(function () {
				tweetmeme_style = 'compact';
				tweetmeme_source = 'MarkRaganCEO';
				tweetmeme_service = 'bit.ly';
				tweetmeme_url_temp = location.href.split('#')[0];
				tweetmeme_url_temp_prefix = 'http://208.66.171.149/Main/Articles/';
				if (tweetmeme_url_temp.split('/')[4].toLowerCase() == 'video') { tweetmeme_url_temp_prefix = 'http://www.ragan.com/Main/Video/'; }
				tweetmeme_url_temp = tweetmeme_url_temp_prefix + tweetmeme_url_temp.split('/')[5];
				tweetmeme_url = tweetmeme_url_temp.replace(":", "%3A");
				if ($(this).attr("retweetlink")) { tweetmeme_url = $(this).attr("retweetlink").replace(":", "%3A"); }
				if ($(this).attr("alt_retweetlink")) { if ($(this).attr("alt_retweetlink") != '') { tweetmeme_url = $(this).attr("alt_retweetlink").replace(":", "%3A"); } }
				$(this).append('<iframe scrolling="no" width="90" height="23" frameborder="0" src="http://api.tweetmeme.com/button.js?url=' + tweetmeme_url + '&amp;style=' + tweetmeme_style + '&amp;source= ' + tweetmeme_source + ' &amp;service=' + tweetmeme_service + '&amp;b=1"></iframe>');
			});
		}
    }

    if ($('.author_name').length) {
        $(".author_name").each(function () {
            // alert('Evoga: ' + $(this).children("a").html());
            if ($(this).children("a").html() == '1 - None')
                $(this).remove();
        });
    }

    if ($('.author').length) {
        $(".author").each(function () {
            // alert($(this).html());
            if (($(this).html() == ' &nbsp;&nbsp;|&nbsp;&nbsp; 1 - None') || ($(this).html() == '1 - None'))
                $(this).remove();
        });
    }

    $("#accordion").tabs("#accordion div.pane", { tabs: 'h2', effect: 'slide', initialIndex: null });
    $("ul.tabs").tabs("div.tabs_panes > div");



    /*if video player is in*/
    if ($('.videohomepage_player').length > 0) {

        /*Populate video*/
        var video_source = $('.video_source').html();
        var video_image = $('.video_image').html();
        var ragan_player = '<object height="350" width="450"><param value="/Uploads/Imports/player/player.swf?file=http://ragan.vo.llnwd.net/o16/VideoCollector/' + video_source + '&amp;logo=/Uploads/Imports/player/watermarkragantv.png&amp;image=' + video_image + '&amp;abouttext=About%20Ragan%20Communications&amp;aboutlink=http://208.66.171.149/&amp;fullscreen=true&amp;stretching=uniform&amp;bufferlength=5&amp;plugins=googlytics-1" name="movie"><param value="true" name="allowFullScreen"><param value="always" name="allowscriptaccess"><embed allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" src="/Uploads/Imports/player/player.swf?file=http://ragan.vo.llnwd.net/o16/VideoCollector/' + video_source + '&amp;image=' + video_image + '&amp;logo=/Uploads/Imports/player/watermarkragantv.png&amp;abouttext=About%20Ragan%20Communications&amp;aboutlink=http://208.66.171.149/&amp;fullscreen=true&amp;stretching=uniform&amp;bufferlength=5&amp;plugins=googlytics-1" width="450" height="350"></object>'
		
		var player_code_question = test_mobi();
		//alert ('Question is ' + player_code_question + ' ' + video_source.replace('/VideoCollector/', '/VideoCollector/mp4/').replace('.flv', '.mp4'));
		if (player_code_question != "flash") {
			//alert('It is not flash:' + video_source);
			if (video_source.indexOf('.flv') > 0) {mobi_video_src = 'http://ragan.vo.llnwd.net/o16/mp4/' + video_source.replace(".flv", ".mp4");} else {
			mobi_video_src = 'http://ragan.vo.llnwd.net/o16/VideoCollector/' + video_source; }
			mobi_image_src = video_image;
			
			if (player_code_question == 'html5') {
				//alert('video code for html5 executed and video source is:' + mobi_video_src);
				ragan_player = '<video id="aVid" width="320" height="240" controls="controls" poster="'+mobi_image_src+'" onclick="this.play();"><source src="'+mobi_video_src+'" type="video/mp4"></source></video>';
			} else {
				ragan_player = '<a href="'+mobi_video_src+'"><img src="'+mobi_image_src+'" /></a>';
			}
			
		}

		if ($('.video_record_youtube').length > 5) { 
			youtube_src = $('.video_record_youtube').html();
			youtube_src_array = youtube_src.split('/');	
			youtube_src = youtube_src_array[youtube_src_array.length - 1].replace('watch?v=','');
			ragan_player = '<iframe width="450" height="350" src="http://www.youtube.com/embed/'+youtube_src+'" frameborder="0" allowfullscreen></iframe>';
		} 

		
        $('.videohomepage_player').append(ragan_player);

        // create custom animation algorithm for jQuery called "drop" 
        $.easing.drop = function (x, t, b, c, d) {
            return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
        };


        // loading animation
        $.tools.overlay.addEffect("drop", function (css, done) {

            // use Overlay API to gain access to crucial elements
            var conf = this.getConf(),
			   overlay = this.getOverlay();

            // determine initial position for the overlay
            if (conf.fixed) {
                css.position = 'fixed';
            } else {
                css.top += $(window).scrollTop();
                css.left += $(window).scrollLeft();
                css.position = 'absolute';
            }

            // position the overlay and show it
            overlay.css(css).show();

            // begin animating with our custom easing
            overlay.animate({ top: '+=55', opacity: 1, width: '+=20' }, 400, 'drop', done);

            /* closing animation */
        }, function (done) {
            this.getOverlay().animate({ top: '-=55', opacity: 0, width: '-=20' }, 300, 'drop', function () {
                $(this).hide();
                done.call();
            });
        }
		);

        $("a[rel]").overlay({
            effect: 'drop',
            mask: '#789'
        });

    }

    /*Video detail page populate vide0 record*/
    if ($('.video_record_image').length > 0) {
		
        var video_source = 'http://ragan.vo.llnwd.net/o16/VideoCollector/' + $('.video_record_video').html();
        var video_image = $('.video_record_image img').attr('src');

       // if (video_image.indexOf("http://") < 0) { video_image = '/Uploads/Imports' + video_image; }

        if (video_image.indexOf("/Resource.ashx") >= 0) { video_image = '' + video_image; } else { }

        //alert('video_source: ' + video_source + ' video_image: ' +video_image );
        var ragan_player_code = '<object height="350" width="450"><param value="http://208.66.171.149/Uploads/Imports/player/player.swf?file=' + video_source + '&amp;logo=http://208.66.171.149/Uploads/Imports/player/watermarkragantv.png&amp;image=http://208.66.171.149' + video_image + '&amp;abouttext=About%20Ragan%20Communications&amp;aboutlink=http://208.66.171.149/&amp;fullscreen=true&amp;stretching=uniform&amp;bufferlength=5&amp;plugins=googlytics-1" name="movie"><param value="true" name="allowFullScreen"><param value="always" name="allowscriptaccess"><param name="wmode" value="transparent" /><embed allowfullscreen="true" allowscriptaccess="always" wmode="transparent" type="application/x-shockwave-flash" src="http://208.66.171.149/Uploads/Imports/player/player.swf?file=' + video_source + '&amp;image=http://208.66.171.149' + video_image + '&amp;logo=http://208.66.171.149/Uploads/Imports/player/watermarkragantv.png&amp;abouttext=About%20Ragan%20Communications&amp;aboutlink=http://208.66.171.149/&amp;fullscreen=true&amp;stretching=uniform&amp;bufferlength=5&amp;plugins=googlytics-1" width="450" height="350"></object>';
        
		var record_url =  location.href.split('#')[0];
		var end_of_record_url_array = record_url.split('_');
		record_url = end_of_record_url_array[end_of_record_url_array.length-1];
		
		var player_code_question = test_mobi();
		//alert ('Question is ' + player_code_question + ' ' + video_source.replace('/VideoCollector/', '/VideoCollector/mp4/').replace('.flv', '.mp4'));
		if (player_code_question != "flash") {
			//alert('It is not flash:' + video_source);
			if (video_source.indexOf('.flv') > 0) {
				mobi_video_src = video_source.replace("/VideoCollector/", "/mp4/");
				mobi_video_src = mobi_video_src.replace(".flv", ".mp4");				
			} else {
				mobi_video_src = video_source;
			}			
			mobi_image_src = video_image;
			
			if (player_code_question == 'html5') {
				//alert('video code for html5 executed and video source is:' + mobi_video_src);
				ragan_player_code = '<video id="aVid" width="320" height="240" controls="controls" poster="'+mobi_image_src+'" onclick="this.play();"><source src="'+mobi_video_src+'" type="video/mp4"></source></video>';
			} else {
				ragan_player_code = '<a href="'+mobi_video_src+'"><img src="'+mobi_image_src+'" /></a>';
			}
			
		}
		
		if ($('.video_record_youtube').length > 0) { 
			youtube_src = $('.video_record_youtube').html();
			youtube_src_array = youtube_src.split('/');	
			youtube_src = youtube_src_array[youtube_src_array.length - 1].replace('watch?v=','');
			ragan_player_code = '<iframe width="450" height="350" src="http://www.youtube.com/embed/'+youtube_src+'" frameborder="0" allowfullscreen></iframe>';
		} 


		ragan_player = ragan_player_code;				
		
		$('.video_record_image').html(ragan_player);
		
		var video_caption = $('.details_summary').html() + '<br /><br /><a class="url_button"><img src="/Uploads/Imports/Media/Images/url_button.jpg" width="65" height="20" alt="Url" border="0" /></a> <a class="embed_button"><img src="/Uploads/Imports/Media/Images/embed_button.jpg" width="65" height="20" border="0" alt="Embed" /></a><div class="url_divtag" style="color:#999999; border:solid 0px #999999; FONT-SIZE: 10px;">URL <textarea id="URLEmbed_Video" style="FONT-SIZE: 10px; height: 16px; overflow:hidden; width:400px; border:solid 1px #999999;" name="URLEmbed" onClick="SelectAll(\'URLEmbed_Video\');" readOnly>' + record_url + '</textarea> </div> <br /> <div class="embed_divtag" style="color:#999999; border:solid 0px #999999; FONT-SIZE: 10px;">EMBED: <textarea id="Embed_Video" style="FONT-SIZE: 10px; height: 50px; overflow:hidden; border:solid 1px #999999; width:600px; vertical-align: top;" name="Embed" onClick="SelectAll(\'Embed_Video\');" readOnly><div class="article_video_embed">'+ ragan_player_code +'</div></textarea></div>';
		$('.details_summary').html(video_caption);
		
		/*toggle (show/hide) effect*/
		$(".embed_button").click(function () {
		$(".embed_divtag").toggle('slow');
		});
		
		$(".url_button").click(function () {
		$(".url_divtag").toggle('slow');
		});

		/*toggle (show/hide) effect end*/
    }

    if ($('.video_record_image_ls').length > 0) {
        $('.video_record_image_ls').each(function () {
            video_image = $(this).attr('src');
            //if (video_image.indexOf("http://") < 0) { video_image = '/Uploads/Imports' + video_image; }
            if (video_image.indexOf("/Resource.ashx") >= 0) { video_image = 'http://208.66.171.149' + video_image; } else { }
            $(this).attr('src', video_image);
        });
    }


    if ($('.video_record_ls').length > 0) {
        $('.video_record_image_ls:first').attr('width', '320');
        $('.video_record_ls:first').attr('class', 'video_record_ls video_record_ls_first');
        var video_first_html = $('.video_record_ls:first').html();
        $('.video_record_ls:first').html('<div class="article_featured_box_top"><img src="/Uploads/Imports/Media/Images/featuredarticle_top.jpg" alt="featuredarticle_top"></div><div class="article_featured_rest"><div>' + video_first_html + '</div></div><div class="article_featured_box_bottom"><img src="/Uploads/Imports/Media/Images/featuredarticle_bottom.jpg" alt="featuredarticle_bottom"></div>');
    }

    if ($('.video_list_full a img').length > 0) {
        var imgsrc_topic = $('.video_list_full a img').attr('src')
        if (imgsrc_topic.indexOf('http://208.66.171.149') > -1) imgsrc_topic = imgsrc_topic.replace("http://208.66.171.149", "");
        if (imgsrc_topic.indexOf('/Media') > -1 && imgsrc_topic.indexOf('http') == -1) $('.video_list_full a img').attr('src', '/Uploads/Imports' + imgsrc_topic);
    }
	
	 if ($('.CpButton').length > 0) {
		 $('.CpButton').removeClass().attr("class", "registerbutton").attr("style", "").attr("onmouseout", "").attr("onmouseover", "");
		 /*<input type="submit" style="width: 100px;" onmouseout="this.className='CpButton';" onmouseover="this.className='CpButton CpButtonHover';" class="CpButton" id="ctl00_ctl00_cphBody_cphCenter_cbtnLogin" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ctl00$cphBody$cphCenter$cbtnLogin&quot;, &quot;&quot;, true, &quot;Login&quot;, &quot;&quot;, false, false))" value="Log In" name="ctl00$ctl00$cphBody$cphCenter$cbtnLogin">*/
	}

});

$(document).ready(function () {

    $("a[rel]").overlay({
        effect: 'drop',
        mask: '#789'
    });
	
	$('input').keypress(function(e){
		if ( e.which == 13 ) return false;
		//or...
		if ( e.which == 13 ) e.preventDefault();
	});
	
});
