var app_url = "http://" + http_host;
var app_ssl_url = "http://" + http_host;
var preview_server = "http://www.mogreet.com/";
var name_limit = 20;

//Self-send theme info
var self_send_preview = new Array();
self_send_preview['clip_id'] = "428";
self_send_preview['search_string'] = "Call Me";

//Select the id that goes into the phone
//var home_clip_id = 2587;
//var home_search_string = 'movies';

var list_page_count;
var grid_page_count;
var cents_part = "";
var add_another_count = 2;
var current_id = 200;
var page_to_show;
var load_state = 1;
var self_send_flag = 0;
var player_key = "web_mogreet";
var player_val = "3.0a";
var campaign_id = "103";
var terms;
var preload_images = new Array();
var my_current_title;
var busy_flag = 0;
//AdWords Vars:
var google_conversion_id = 1059572785;
var google_conversion_language = "en_US";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "nsKhCNmPbRCxmJ_5Aw";
if (0.45) {var google_conversion_value = 0.45;}

set_cookie("current_view","list");

var header_html = '<div id="logo"><a href="index.rb"><img src="images/logo_orange.jpg" width="290" height="69" border="0" /></a></div><div id="sign_in"></div>';
			
var footer_html = '<div id="footer_rounded">' +
'<div id="copyright_info">' +
'<div>' +
'&copy; Copyright 2010 Mogreet, Inc. | ' + 
'<a href="index.rb">Home</a> |' + 
'<a href="index.rb?v=about">About the Company</a> |' + 
'<a href="index.rb?v=faq">Help</a> |' + 
'<a href="index.rb?v=legal">Legal & Privacy Policy</a> |' + 
'<a href="index.rb?v=sitemap">Sitemap</a>' +  
'</div>' +
'</div>' +
'<img src="images/container_bottom.png" width="942" height="16">' +
'</div>' +
'<div id="logos">' +  
'Supported Carriers:<br /><img src="http://d2c.bandcon.mogreet.com/images/footer_logo.png" width="850" height="92" alt="Supported Carriers: Alltel, AT&T, Boost Mobile, Unicel, Sprint together with Nextel, T-Mobile, Verizon Wireless" />' +
'</div>';

var log_in_box_html = '<div id="sign_in">' +
'<form name="signin_form" method="post" action="users/">' +
'<table cellspacing="5"><tr><td>Mobile #:</td>' +
'<td><input id="username" class="login" /></td>' +
'<td>Password:</td>' +
'<td><input id="password" type="password" class="login" /></td>' +
'<td><a href="#" onClick="validate_signin_form();"><img src="images/btn_login.jpg" border="0"/></a></td>' +					
'</tr><tr>' +
'<td colspan="5">Not a member? <a href="index.rb?v=register">Register Here</a></td>' +	
'</tr></table></form></div>';
		
var about_gnav_html = '<div id="title"><img src="images/title_links.jpg"></div>' + 
'<div id="link_item"><a href="index.rb?v=about">About The Company</a></div>' + 	
'<div id="link_item"><a href="index.rb?v=what_is">What is a Mogreet?</a></div>' + 	
'<div id="link_item"><a href="index.rb?v=team">The Team</a></div>' + 
'<div id="link_item"><a href="index.rb?v=press">Press</a></div>' +
'<div id="link_item"><a href="index.rb?v=marketing_stories">Marketing Stories</a></div>' + 							
'<div id="link_item"><a href="index.rb?v=investors">Investor Relations</a></div>' + 							
'<div id="link_item"><a href="index.rb?v=partners">Partners</a></div>' + 
'<div id="link_item"><a href="index.rb?v=jobs">Job Opportunities</a></div>' + 
'<div id="link_item"><a href="index.rb?v=contact">Contact</a></div>' + 
'<div id="link_item"><a href="index.rb?v=where_else">Where Else is Mogreet?</a></div>';
								
var howto_gnav_html = '<div id="title"><img src="images/title_links.jpg"></div>' + 
'<div id="link_item"><a href="index.rb?v=faq">FAQ</a></div>' + 	
'<div id="link_item"><a href="index.rb?v=phones">Phone Compatibility</a></div>' +  	
'<div id="link_item"><a href="index.rb?v=support">Customer Support</a></div>'+
'<div id="link_item"><a href="index.rb?v=sitemap">Sitemap</a></div>';
				
var legal_gnav_html = '<div id="title"><img src="images/title_links.jpg"></div>' + 
'<div id="link_item"><a href="index.rb?v=legal_terms">Terms</a></div>' + 	
'<div id="link_item"><a href="index.rb?v=privacy">Privacy Policy</a></div>' + 	
'<div id="link_item"><a href="index.rb?v=agreement">User Agreement</a></div>';

var email_landing_gnav_html = '<div id="title"><img src="images/title_links.jpg"></div>' + 
'<div id="link_item"><a href="index.rb?v=browse&terms=birthday">Happy Birthday</a></div>' + 	
'<div id="link_item"><a href="index.rb?v=browse&terms=sorry">I\'m Sorry</a></div>' + 	
'<div id="link_item"><a href="index.rb?v=browse&terms=movie">Movies</a></div>';
				
var get_involved_gnav_html = '<div id="title"><img src="images/title_links.jpg"></div>' +
'<div id="link_item"><a href="index.rb?v=guidelines">Guidelines</a></div>' +
'<div id="link_item"><a href="index.rb?v=idea_factory">Idea Factory</a></div>' +
'<div id="link_item"><a href="index.rb?v=occasions">Mogreet Occasions List</a></div>' + 
'<div id="link_item"><a href="index.rb?v=tech_specs">Technical Specifications</a></div>' + 	
'<div id="link_item"><a href="index.rb?v=get_involved_faq">FAQ</a></div>' + 	
'<div id="link_item"><a href="index.rb?v=get_involved_legal">Legal</a></div>' + 
'<div id="link_item"><a href="index.rb?v=download">Send Us Your Mogreets</a></div>' + 							
'<div id="link_item"><a href="index.rb?v=get_involved_contact">Help/Contact</a></div>';
								
var heros = '<div id="about_content_right_middle">' +  
'<a href="index.rb?v=browse&terms=paramount"><img width="160" src="http://d2c.bandcon.mogreet.com/images/ad_paramount_v02.jpg" border="0" /></a></div>' +  
'<div id="about_content_right_bottom"><img src="http://d2c.bandcon.mogreet.com/images/categories_list_bottom.jpg" height="9" width="177"/></div>';

var agree_to_terms_text = '<table cellspacing="3" border="0" width="100%"><tr><td><img src="http://d2c.bandcon.mogreet.com/images/form_yield.png" width="58" height="58" /></td><td>Please read and agree to the terms.</td></tr></table>';

var search_box_text = "Enter Your Search Terms Here";

var subpage_search_box = '<div id="search_field"><form id="terms_part"><input id="search_terms" onFocus="this.value=\'\'" name="search" type="text" value="' + search_box_text + '" size="35" class="input" /></form></div>' + 
'<div id="search_button">' +
'<form method="get" action="index.rb" id="submit_part">' +
'<a href="#" onClick="execute_hompeage_search();"><img src="http://d2c.bandcon.mogreet.com/images/btn_search.png" border="0" width="69" height="23" /></a>' +
'<input type="hidden" name="terms" id="terms" value=""><input type="hidden" name="v" id="v" value="browse"></form></div>';

var leaderboard_html = '<div id="container_top">&nbsp;</div>' ;
//'<div style="margin: 0pt auto 5px; height: 90px; width:728px; border:1px solid #DDDDDD; padding:2px;"></div>'; +
//<a href="http://www.rockvilleca.com" target="_blank"><img src="images/ad_rockville.jpg" alt="Rockville" width="728" height="90" border="0"></a>' +
'<div id="container_top">&nbsp;</div>' ;

function clear_browse_loader(){if($("loader")){$("loader").innerHTML = "";}}
function clear_browse_results(){if($("results")){$("results").innerHTML = '<div id="search_text"></div><div id="my_clips"></div>';}}

function display_init(page){
	if(page == "home"){
		self_send_preview['clip'] = get_by_clip_id(self_send_preview['clip_id'],'store_self_send_preview_clip()','json');
		draw_init_content("leaderboard");
      	draw_init_content("container");
      	draw_init_content("header");
      	draw_init_content("main_msg");
      	draw_init_content("categories");
      	draw_init_content("phone");
	}
	
	if(page == "browse"){
		draw_browse_init_display("leaderboard");
      	draw_browse_init_display("container");
      	draw_browse_init_display("header");
      	draw_browse_init_display("page_header");
      	draw_browse_init_display("content");
		draw_browse_init_display("results");
	}
	
	if(page == "about"){
    	draw_about_init_display("leaderboard");
		draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("9","parse_articles()","xml");		
	}
	
	if(page == "email_landing"){
		draw_email_landing_init_display("leaderboard");
    	draw_email_landing_init_display("container");
    	draw_email_landing_init_display("header");
    	draw_email_landing_init_display("page_header");
    	draw_email_landing_init_display("about_content");
		get_transaction_data(tid,"xml","parse_transaction_data");		
	}
	
	if(page == "forgot_password"){
		draw_forgot_password_init_display("leaderboard");	
    	draw_forgot_password_init_display("container");	
		draw_forgot_password_init_display("header");	
		draw_forgot_password_init_display("main_msg");	
	}
	
	if(page == "explore"){
    	draw_terms_init_display("leaderboard");
		draw_terms_init_display("container");
    	draw_terms_init_display("header");
    	draw_terms_init_display("page_header");
    	draw_terms_init_display("about_content");
		get_article("9","parse_articles()","xml");	
	}
	
	if(page == "terms"){
		draw_terms_init_display("leaderboard");
    	draw_terms_init_display("container");
    	draw_terms_init_display("header");
    	draw_terms_init_display("page_header");
    	draw_terms_init_display("about_content");
		get_article("85","parse_articles()","xml");		
	}
	
	if(page == "legal_terms"){
		draw_terms_init_display("leaderboard");
    	draw_terms_init_display("container");
    	draw_terms_init_display("header");
    	draw_terms_init_display("page_header");
    	draw_terms_init_display("about_content");
		get_article("85","parse_articles()","xml");		
	}
	
	if(page == "register"){
		draw_register_init_display("leaderboard");
    	draw_register_init_display("container_register");
    	draw_register_init_display("header");
    	draw_register_init_display("main_msg");
	}
	
	if(page == "how_to"){
    	draw_how_to_init_display("leaderboard");
		draw_how_to_init_display("container");
    	draw_how_to_init_display("header");
    	draw_how_to_init_display("page_header");
    	draw_how_to_init_display("about_content");
		get_article("7","parse_articles()","xml");
	}
	
	if(page == "contact"){
		draw_contact_init_display("leaderboard");    
		draw_contact_init_display("container");
    	draw_contact_init_display("header");
    	draw_contact_init_display("page_header");
    	draw_contact_init_display("about_content");
		get_article("14","parse_articles()","xml");
	}
	
	if(page == "get_involved_contact"){
    	draw_contact_init_display("leaderboard");
		draw_contact_init_display("container");
    	draw_contact_init_display("header");
    	draw_contact_init_display("page_header");
    	draw_contact_init_display("about_content");
		get_article("32","parse_articles()","xml");
	}
	
	if(page == "guidelines"){
    	draw_contact_init_display("leaderboard");
		draw_contact_init_display("container");
    	draw_contact_init_display("header");
    	draw_contact_init_display("page_header");
    	draw_contact_init_display("about_content");
		get_article("66","parse_articles()","xml");
	}
	
	if(page == "idea_factory"){
    	draw_contact_init_display("leaderboard");
		draw_contact_init_display("container");
    	draw_contact_init_display("header");
    	draw_contact_init_display("page_header");
    	draw_contact_init_display("about_content");
		get_article("68","parse_articles()","xml");
	}
	
	if(page == "jobs"){
    	draw_jobs_init_display("leaderboard");
		draw_jobs_init_display("container");
    	draw_jobs_init_display("header");
    	draw_jobs_init_display("page_header");
    	draw_jobs_init_display("about_content");
		get_article("44","parse_articles()","xml");		
	}
	
	if(page == "partners"){
    	draw_partners_init_display("leaderboard");
		draw_partners_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("10","parse_articles()","xml");		
	}
	
	if(page == "investors"){
    	draw_investors_init_display("leaderboard");
		draw_investors_init_display("container");
    	draw_investors_init_display("header");
    	draw_investors_init_display("page_header");
    	draw_investors_init_display("about_content");
		get_article("13","parse_articles()","xml");		
	}
	
	if(page == "get_involved"){
    	draw_get_involved_init_display("leaderboard");
		draw_get_involved_init_display("container");
    	draw_get_involved_init_display("header");
    	draw_get_involved_init_display("page_header");
    	draw_get_involved_init_display("about_content");
		get_article("41","parse_articles()","xml");		
	}
	
	if(page == "team"){
    	draw_team_init_display("leaderboard");
		draw_team_init_display("container");
    	draw_team_init_display("header");
    	draw_team_init_display("page_header");
    	draw_team_init_display("about_content");
		get_article("11","parse_articles()","xml");		
	}
	
	if(page == "history"){
		draw_history_init_display("leaderboard");
    	draw_history_init_display("container");
    	draw_history_init_display("header");
    	draw_history_init_display("page_header");
    	draw_history_init_display("about_content");
		get_article("42","parse_articles()","xml");		
	}
	
	if(page == "agreement"){
    	draw_about_init_display("leaderboard");
		draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("48","parse_articles()","xml");		
	}	

	if(page == "download"){
    	draw_about_init_display("leaderboard");
		draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("33","parse_articles()","xml");		
	}
	
	if(page == "faq"){
    	draw_about_init_display("leaderboard");
		draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("88","parse_articles()","xml");		
	}
	
	if(page == "get_involved_faq"){
    	draw_about_init_display("leaderboard");
		draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("34","parse_articles()","xml");		
	}
	
	if(page == "legal"){
    	draw_about_init_display("leaderboard");
		draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("85","parse_articles()","xml");		
	}
	
	if(page == "get_involved_legal"){
    	draw_about_init_display("leaderboard");
		draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("36","parse_articles()","xml");		
	}
	
	if(page == "sitemap"){
		draw_about_init_display("leaderboard");	
    	draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("89","parse_articles()","xml");		
	}
	
	if(page == "phones"){
		draw_about_init_display("leaderboard");	
    	draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("25","parse_articles()","xml");		
	}

	if(page == "press"){
    	draw_about_init_display("leaderboard");
		draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("12","parse_articles()","xml");		
	}

	if(page == "privacy"){
    	draw_about_init_display("leaderboard");
		draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("47","parse_articles()","xml");		
	}

	if(page == "support"){
    	draw_about_init_display("leaderboard");
		draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("26","parse_articles()","xml");		
	}
	
	if(page == "tech_specs"){
		draw_about_init_display("leaderboard");
		draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("31","parse_articles()","xml");		
	}
	
	if(page == "occasions"){
		draw_about_init_display("leaderboard");
    	draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("30","parse_articles()","xml");		
	}
		
	if(page == "what_is"){
    	draw_about_init_display("leaderboard");
		draw_about_init_display("container");
    	draw_about_init_display("header");
    	draw_about_init_display("page_header");
    	draw_about_init_display("about_content");
		get_article("7","parse_articles()","xml");		
	}
	
	if(page == "where_else"){
    	draw_where_else_init_display("leaderboard");
		draw_where_else_init_display("container");
    	draw_where_else_init_display("header");
    	draw_where_else_init_display("page_header");
    	draw_where_else_init_display("about_content");
		get_article("45","parse_articles()","xml");		
	}
	
	if(page == "marketing_stories"){
    	draw_where_else_init_display("leaderboard");
		draw_where_else_init_display("container");
    	draw_where_else_init_display("header");
    	draw_where_else_init_display("page_header");
    	draw_where_else_init_display("about_content");
		get_article("51","parse_articles()","xml");		
	}
	
	$('header').innerHTML = header_html;
	$('footer').innerHTML = footer_html;	
}

function parse_articles(){
	pageTracker._trackPageview('/mogreet/article_view');
	raw_response = parse_articles.arguments[0];
	title_start = raw_response.indexOf("<title>");
	title_stop = raw_response.indexOf("</title>");
	article_title = raw_response.substring(title_start + 7,title_stop);
	
	subtitle_start = raw_response.indexOf("<subtitle>");
	subtitle_stop = raw_response.indexOf("</subtitle>");
	article_subtitle = raw_response.substring(subtitle_start + 10,subtitle_stop);
	
	url_start = raw_response.indexOf("<url>");
	url_stop = raw_response.indexOf("</url>");
	article_url = raw_response.substring(url_start + 5,url_stop);
	
	author_start = raw_response.indexOf("<author>");
	author_stop = raw_response.indexOf("</author>");
	article_author = raw_response.substring(author_start + 8,author_stop);
	
	content_start = raw_response.indexOf("<content>");
	content_stop = raw_response.indexOf("</content>");
	article_content = raw_response.substring(content_start + 9,content_stop);
	
	mod_date_start = raw_response.indexOf("<mod_date>");
	mod_date_stop = raw_response.indexOf("</mod_date>");
	article_date = raw_response.substring(mod_date_start + 10,mod_date_stop);
	
	loc_start = raw_response.indexOf("<location>");
	loc_stop = raw_response.indexOf("</location>");
	article_location = raw_response.substring(loc_start + 10,loc_stop);

	new_html = "";
	if(article_url == ""){
		new_html = '<span class="title">' + article_title + '</span><br/>';
		new_html += '<span class="content">' + article_content + '</span><br />';
	}
	else {new_html += '<iframe style="height:400px;width:600px;" src="' + article_url + '"></iframe>';}
	$("content_text").innerHTML = new_html;
}

function parse_join_results(){
	raw_response = parse_join_results.arguments[0];
	if(raw_response.indexOf('message type="success"') != "-1"){$("form").innerHTML = raw_response;}
	else{document.location = "/users/index.rb";}
}

function parse_log_in_results(){
	raw_response = parse_log_in_results.arguments[0];
	if(raw_response.indexOf('success') != "-1"){document.location = "users/";}
	else {alert("failed");}
}

function parse_send_results() {
	pageTracker._trackPageview('/mogreet/send_attempt');
	raw_response = parse_send_results.arguments[0];
	cleaned_response = raw_response.replace("<![CDATA[","");
	cleaned_response = cleaned_response.replace("]]>","");
	
	if(raw_response.indexOf("success") != "-1"){
		pageTracker._trackPageview('/mogreet/send_success');
		$("form_error").setAttribute("class","form_correct");
		$("form_error").setAttribute("className","form_correct");
		new_html = '<table cellspacing="3" border="0" width="100%"><tr><td><img src="http://d2c.bandcon.mogreet.com/images/form_check.png" width="65" height="58" /></td><td>' + cleaned_response + '</td></tr></table>';
		$("clear_button").style.display = "inline-block";	
	}
	else if(raw_response.indexOf("warning") != "-1"){
		pageTracker._trackPageview('/mogreet/send_warning');
		$("form_error").setAttribute("class","form_warning");
		$("form_error").setAttribute("className","form_warning");
		new_html = '<table cellspacing="3" border="0" width="100%"><tr><td><img src="http://d2c.bandcon.mogreet.com/images/form_yield.png" width="58" height="58" /></td><td>' + cleaned_response + '</td></tr></table>';
	}
	else{
		pageTracker._trackPageview('/mogreet/send_error');
		$("form_error").setAttribute("class","form_error");
		$("form_error").setAttribute("className","form_error");
		new_html = '<table cellspacing="3" border="0" width="100%"><tr><td><img src="http://d2c.bandcon.mogreet.com/images/form_yield.png" width="58" height="58" /></td><td>' + cleaned_response + '</td></tr></table>';
	}
	
	$("form_error").innerHTML = new_html;
	$("loading_ani").innerHTML = "";
	$("form_error").style.display = "block";
	
	var google_conversion_id = 1059572785;
	var google_conversion_language = "en_US";
	var google_conversion_format = "3";
	var google_conversion_color = "ffffff";
	var google_conversion_label = "nsKhCNmPbRCxmJ_5Aw";
	if (0.45) {var google_conversion_value = 0.45;}
	$("form_error").innerHTML += '<img height="1" width="1" border="0" src="http://www.googleadservices.com/pagead/conversion/1059572785/?value=0.45&amp;label=nsKhCNmPbRCxmJ_5Aw&amp;script=0"/>';
}

function parse_home_send_results() {
	raw_response = parse_home_send_results.arguments[0];
	cleaned_response = raw_response.replace("<![CDATA[","");
	cleaned_response = cleaned_response.replace("]]>","");
	cleaned_response = cleaned_response.replace(" using Promo Code: anthoblake","");
	error_test = raw_response.indexOf("success");
	if(error_test == "-1"){cleaned_response = cleaned_response + "<p/><a href='#' onClick='post_send_action();return false;'>Go back and try again.</a>";}
	else {cleaned_response = cleaned_response + "<p/><a target='_top' href='index.rb?v=browse&terms=movie'>Click here</a> to view and send more Mogreets";}
	window.top.frames['my_frame'].document.body.style.backgroundColor = "#000";	
	window.top.frames['my_frame'].document.body.style.fontFamily = "sans-serif";
	window.top.frames['my_frame'].document.body.style.fontSize = "12px";
	window.top.frames['my_frame'].document.body.style.color = "#EEEEEE";
	window.top.frames['my_frame'].document.body.style.lineHeight = "140%";
	window.top.frames['my_frame'].document.body.innerHTML = cleaned_response;9
}

function parse_clip_info(){
	raw_response = parse_clip_info.arguments[0];
	id_start = raw_response.indexOf("<id>");
	id_stop = raw_response.indexOf("</id>");
	clip_id = raw_response.substring(id_start + 4,id_stop);
	title_start = raw_response.indexOf("<name>");
	title_stop = raw_response.indexOf("</name>");
	my_current_title = raw_response.substring(title_start + 6,title_stop).substring(0,30);
	price_start = raw_response.indexOf("<price>");
	price_stop = raw_response.indexOf("</price>");
	url_start = raw_response.indexOf("<url>");
	url_stop = raw_response.indexOf("</url>");
	url = raw_response.substring(url_start + 5,url_stop);
	price = raw_response.substring(price_start + 7,price_stop);
	
	//Super Hack
	regexp = /<flv type="content" .* file="(\d+_\d+).flv" .*<\/flv>/;
	regexp_result_array = regexp.exec(raw_response);
	clip_version = regexp_result_array[1];
	load_first_clip(clip_version);
	temp_raw_response = raw_response;
	
	browse_set_id(clip_id,my_current_title,price,clip_version,url);
}

function parse_search_results(){
	clear_browse_loader();
	clear_browse_results();
	raw_response = parse_search_results.arguments[0];
	draw_search_results_text(raw_response);
	draw_search_results(raw_response);
	busy_flag = 0;
}

//Super Hack
var temp_raw_response;
function set_temp_raw_response(){temp_raw_response = set_temp_raw_response.arguments[0];}
function parse_search_results2(){
	if(!temp_raw_response){
		passed_clip_id = search_string.split("_");
		get_by_clip_id(passed_clip_id[0],'set_temp_raw_response');
		setTimeout('parse_search_results2('+parse_search_results2.arguments[0]+')',1000);
		return false;
	}
	clear_browse_loader();
	clear_browse_results();
	raw_response = temp_raw_response + parse_search_results2.arguments[0];
	draw_search_results_text(raw_response);
	draw_search_results(raw_response);
	busy_flag = 0;
	temp_raw_response = null;
}

function draw_search_results_text(raw_response){
	step_one = raw_response.split('</clip></playlist>');
	if(raw_response == ""){$('search_text').innerHTML = '<div id="title">0 Search Results for <span class="search_term">' + search_string + '</span></div><p style="margin:0 10px 10px 10px;">Sorry, your search did not return any results.  Please try another search or browse some of our most popular Mogreets below.</p>';		}
	else{$('search_text').innerHTML = '<div id="title">' + (step_one.length - 1) + ' Search Results for <i>' + search_string + '</i></div>';}
}

function draw_search_results(raw_response){
	if(raw_response == ""){raw_response = parse_search_results.arguments[0];}
	if(raw_response == ""){get_featured_clips("draw_search_results");}
	else {
		clip_id = new Array();
		my_title = new Array();
		category = new Array();
		marcom = new Array();
		price = new Array();
		thumb = new Array();
		path = new Array();
		var url = new Array();
		step_one = raw_response.split('</clip></playlist>');
	
		for(x=0;x<step_one.length - 1;x++){
			id_start = step_one[x].indexOf("<id>");
			id_stop = step_one[x].indexOf("</id>");
			clip_id[x] = step_one[x].substring(id_start + 4,id_stop);
		
			title_start = step_one[x].indexOf("<name>");
			title_stop = step_one[x].indexOf("</name>");
			my_title[x] = step_one[x].substring(title_start + 6,title_stop).substring(0,30);
		
			category_start = step_one[x].indexOf("<category>");
			category_stop = step_one[x].indexOf("</category>");
			category[x] = step_one[x].substring(category_start + 10,category_stop);
		
			marcom_start = step_one[x].indexOf("<marcom>");
			marcom_stop = step_one[x].indexOf("</marcom>");
			marcom[x] = step_one[x].substring(marcom_start + 8,marcom_stop);
			if(marcom[x].length > 40){marcom[x] = marcom[x] + "...";}
		
			price_start = step_one[x].indexOf("<price>");
			price_stop = step_one[x].indexOf("</price>");
			price[x] = step_one[x].substring(price_start + 7,price_stop);
			
			price[x] = price[x].replace("$0.49","$0.49");
			price[x] = price[x].replace("$0.99","$0.99");
			price[x] = price[x].replace("$0","$0");
		
			thumb_start = step_one[x].indexOf("<thumb>");
			thumb_stop = step_one[x].indexOf("</thumb>");
			thumb[x] = step_one[x].substring(thumb_start + 7,thumb_stop);
			
			url_start = step_one[x].indexOf("<url>");
			url_stop = step_one[x].indexOf("</url>");
			url[x] = step_one[x].substring(url_start + 5,url_stop);
		
			trim_start = step_one[x].indexOf('<flv type="content"');
			one = step_one[x].substring(trim_start);
			two = one.split('file="');
			three = two[1].split(".flv");
			path[x] = three[0];		
		}
	
		if(self_send_flag != 1){
			load_first_clip(path[0]);
			browse_set_id(clip_id[0],"" + my_title[0] + "","" + price[0] + "","" + path[0] + "","" + url[0] + "");
		}
		
		list_results_per_page = 5;
		grid_results_per_page = 12;
		clip_count = clip_id.length - 1;
		
		grid_page_count = Math.round(clip_count/grid_results_per_page);
		grid_last_page = Math.floor(clip_count/grid_results_per_page);
		if(grid_page_count == grid_last_page){grid_page_count = grid_page_count + 1;}
		grid_records_on_last_page = (clip_count - (grid_last_page*grid_results_per_page)) + 1;
		if(clip_count == "-1"){clip_count = "0";}
		else{clip_count = clip_count + 1;}

    	page_offset = 0;
		for(r=0;r<=grid_page_count;r++){
			if(r == 0){display_type = "block";}
			else{display_type = "none";}
        	new_html = new_html + '<div id="mogreets_' + r + '" style="overflow:hidden;display:' + display_type + '">';
			new_html = draw_pagenation(new_html,grid_page_count,grid_page_count,"top","grid",r);
			if(clip_id.length > grid_results_per_page){grid_loop_count = grid_results_per_page - 1;}
			else{grid_loop_count = clip_id.length - 1;} 
			if(r == grid_page_count){grid_loop_count = grid_records_on_last_page - 1;}
			for(y=0;y<=grid_loop_count;y++){
				record_id = y + page_offset;
				orig_title = my_title[record_id];
				if(my_title[record_id]){my_title[record_id] = title_parser(my_title[record_id]);}
				if(path[record_id]){
					new_html = new_html + '<div id="mogreet_item">' + 
								  	  	  //'<div><div id="play_button"><a href="player.rb?id=' + path[record_id] + '&ref=browse" target="video_iframe" onClick="browse_set_id(' + clip_id[record_id] + ',\'' + orig_title + '\',\'' + price[record_id] + '\');set_title(\'' + my_title[record_id] + '\')"><img src="images/btn_play.png" border="0" height="22" width="22"></a></div>' +
										  '<div><div id="play_button">' +
										  '<a href="#" onClick="browse_set_id(' + clip_id[record_id] + ',\'' + orig_title + '\',\'' + price[record_id] + '\',\'' + path[record_id] + '\',\'' + url[record_id] + '\');return false;"><img src="http://d2c.bandcon.mogreet.com/images/btn_play.png" border="0" height="22" width="22"></a></div>' +
				   			  	  	      '<div id="thumb">' +
                   			  	     	  //'<a href="player.rb?id=' + path[record_id] + '&ref=browse" target="video_iframe" onClick="browse_set_id(' + clip_id[record_id] + ',\'' + orig_title + '\',\'' + price[record_id] + '\');" onMouseOut=""><img src="' + thumb[record_id] + '" border="0" height="68" width="90" /> </a></div>' +
										  '<a href="#" onClick="browse_set_id(' + clip_id[record_id] + ',\'' + orig_title + '\',\'' + price[record_id] + '\',\'' + path[record_id] + '\',\'' + url[record_id] + '\');return false;" onMouseOut=""><img src="' + thumb[record_id] + '" border="0" height="68" width="90" /> </a></div>' +
                   			  	    	  '<a href="#" onClick="browse_set_id(' + clip_id[record_id] + ',\'' + orig_title + '\',\'' + price[record_id] + '\',\'' + path[record_id] + '\',\'' + url[record_id] + '\');return false;"><span class="mogreet_title">' + my_title[record_id] + '</span></a><br />' +
                   			    	  	  '<a href="index.rb?v=browse&type=cat&terms=' + category[record_id] + '">' + category[record_id] + '</a><br />' + 
				   			    	  	  'Price: ' + price[record_id] + 
							    	  	  '</div></div>';
				}
			}
			new_html = new_html + '</div>';
			page_offset = page_offset + 12;
		}
	
/////////////////////////

		clip_count = clip_id.length - 1;
		list_page_count = Math.round(clip_count/list_results_per_page);
		last_page = Math.floor(clip_count/list_results_per_page);
		if(list_page_count == last_page){list_page_count = list_page_count + 1;}
		records_on_last_page = (clip_count - (last_page*list_results_per_page)) + 1;
		if(clip_count == "-1"){clip_count = "0";}
		else{clip_count = clip_count + 1;}

    page_offset = 0;
	for(r=0;r<=list_page_count;r++){
			if(r == 0){display_type = "none";}
			else{display_type = "none";}
        	new_html = new_html + '<div id="mogreets_list_' + r + '" style="overflow:hidden;display:' + display_type + '">';
			new_html = draw_pagenation(new_html,list_page_count,list_page_count,"top","list",r);


			if(clip_id.length > list_results_per_page){loop_count = list_results_per_page - 1;}
			else{loop_count = clip_id.length - 1;} 
			if(r == list_page_count){loop_count = records_on_last_page - 1;}
			for(y=0;y<=loop_count;y++){
				record_id = y + page_offset;
				orig_title = my_title[record_id];
				if(my_title[record_id]){my_title[record_id] = title_parser(my_title[record_id]);}
				if(path[record_id]){
				new_html = new_html + '<div id="mogreet_item_list">' + 
							 	      '<div><div id="play_button"><a href="#" onClick="browse_set_id(' + clip_id[record_id] + ',\'' + orig_title + '\',\'' + price[record_id] + '\',\'' + path[record_id] + '\',\'' + url[record_id] + '\');return false;"><img src="images/btn_play.png" border="0" height="22" width="22"></a></div>' +
				   			  	  	  '<table cellspacing="5"><tr><td valign="top">' +
                   			  	  	  '<a href="#" onClick="browse_set_id(' + clip_id[record_id] + ',\'' + orig_title + '\',\'' + price[record_id] + '\',\'' + path[record_id] + '\',\'' + url[record_id] + '\');return false;"><img src="' + thumb[record_id] + '" border="0" height="68" width="90" /> </a></td>' +
                   			  	  	  '<td valign="top"><a href="#" onClick="browse_set_id(' + clip_id[record_id] + ',\'' + orig_title + '\',\'' + price[record_id] + '\',\'' + path[record_id] + '\',\'' + url[record_id] + '\');return false;"><span class="mogreet_title">' + my_title[record_id] + '</span></a><br/>' + marcom[record_id] + '<br />' +
                   			  	  	  '<a href="index.rb?v=browse&type=cat&terms=' + category[record_id] + '">' + category[record_id] + '</a><br />' + 
				   			  	  	  'Price: ' + price[record_id] + 
								  	  '</td></tr></table></div></div>';
				}
			}
			new_html = new_html + '</div>';
			page_offset = page_offset + 5;
		}
	
		$('my_clips').innerHTML = new_html;
	}	
}

function parse_carrier_test_results(){raw_response = parse_carrier_test_results.arguments[0];}

function load_first_clip(clip_id){
	/*player_path = app_url + "/player.rb?id=" + clip_id + "&ref=browse";
	$('video_iframe').src = player_path;*/
	if(terms == "selfsend"){
		if (!self_send_preview.clip){setTimeout("load_first_clip('')",100);return false;}
		$("mogreet_title").innerHTML = self_send_preview.clip.title;
		$("current_clip_id").value = self_send_preview.clip_id;
		$("cents_part").innerHTML = self_send_preview.clip.price;
		if(self_send_preview.clip.url && self_send_preview.clip.url != ""){
			$("clip_url").innerHTML = '<a href="' + self_send_preview.clip.url + '" target="_blank">Buy the DVD at http://mobile.paramount.com</a>';
		}
		flv = self_send_preview.clip.flv.name;
		flv_version = flv.slice(0,flv.lastIndexOf('.'));
		player_embed = '<object width="240" height="180" id="myspace_flv_player" align="middle" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="movie" value="http://www.mogreet.com/flash/'+flv_version+'/myspace_player_1.swf" /><embed src="http://www.mogreet.com/flash/'+flv_version+'/myspace_player_1.swf" width="240" height="180" name="myspace_flv_player" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
	} else {
		player_embed = '<object width="240" height="180" id="myspace_flv_player" align="middle" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="movie" value="http://www.mogreet.com/flash/'+clip_id+'/myspace_player_1.swf" /><embed src="http://www.mogreet.com/flash/'+clip_id+'/myspace_player_1.swf" width="240" height="180" name="myspace_flv_player" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
		clip = clip_id.split("_");
		$("current_clip_id").value = clip[0];
	}
	$("browse_video_frame").innerHTML = player_embed;
}

function title_parser(long_name) {
	title_length = long_name.length;
	if(title_length > 28){trimmed_name = long_name.substr(0,27) + "...";}
	else {trimmed_name = long_name.substr(0,27);}
	return trimmed_name;
}

function get_div_content(page_name,query_string,div_name){
	ajax_url = app_url;
	var xhr = createXMLHttpRequest();
	xhr.onreadystatechange = function () {if(xhr.readyState == 4) {if(xhr.status == 200){$(div_name).innerHTML = xhr.responseText;}}}
	my_content_url = ajax_url + "/ajax/" + page_name + ".rb?" + query_string + "&d=" + new Date().getTime();
	xhr.open("GET",my_content_url,true);
	xhr.send(null);	
}

function post_search(){
	terms = $("search_terms").value;
	document.location = "index.rb?v=browse&terms=" + terms;
}

function execute_hompeage_search(){
	search_terms = $("terms_part").search.value;
	search_terms = search_terms.replace("&","and");
	if(search_terms == ""){alert("Please search on something!");}
	else {
		$("submit_part").terms.value = search_terms;
		$("submit_part").submit();
	}
}

function terms_search() {
	terms = $('search_terms').value;
	terms = terms.replace("&","and");
	document.location = "index.rb?v=browse&terms=" + terms;
}

function browse_set_id(id,title,price,flvid,url){
	if(url && url!=""){
		$("clip_url").innerHTML = '<a href="' + url + '" target="_blank">Buy the DVD at ' + url + '</a>';
	} else {
		$("clip_url").innerHTML = '';
	}
	if($("t")){$("t").value = title;}
	$("mogreet_title").innerHTML = title;
	$("current_clip_id").value = id;
	current_id = id;
	$("cents_part").innerHTML = price;
	cents_part = price;
	player_embed = '<object width="240" height="180" id="myspace_flv_player" align="middle" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="movie" value="http://www.mogreet.com/flash/'+flvid+'/myspace_player_1.swf" /><embed src="http://www.mogreet.com/flash/'+flvid+'/myspace_player_1.swf" width="240" height="180" name="myspace_flv_player" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
	$("browse_video_frame").innerHTML = player_embed;
	
	log_player2("play", campaign_id, current_id, player_key, player_val, "", "dummy");
}

function set_sender_price(){$("cents_part").innerHTML = cents_part;}

function stopRKey(evt) {
  var evt = (evt) ? evt : ((event) ? event : null);
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  if ((evt.keyCode == 13) && (node.type=="text"))  {execute_hompeage_search();return false;}
}

function stopBKey(evt) {
  var evt = (evt) ? evt : ((event) ? event : null);
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  if ((evt.keyCode == 13) && (node.type=="text"))  {terms_search();return false;}
}

function home_page_self_send() {
	if(document.send_form.terms.checked == false){alert(agree_to_terms_text);}
	else {
		clip_id = "2587_44281";
		from = $("receivernumber").value;
		from_name = "me";
		to = $("receivernumber").value;
		my_message = $("message").value;
		promo = "anthoblake";
		//Get actual value
		tnc = "true";
		flow_type = "replyY";
		window.top.frames['my_frame'].document.body.style.backgroundColor = "#000";
		window.top.frames['my_frame'].document.body.innerHTML = "<center><img src='images/loading.gif'></center>";
		send_validation_test = "1";
		if(send_validation_test == "1"){
			send_mogreet2(campaign_id,clip_id,from,from_name,to,"",my_message,promo,player_key,player_val,"","parse_2662_send_results");
		}
		else {alert("ISSUES");}	
	}
}

function browse_page_sender() {
	document.location.href = "#top";
	$("loading_ani").innerHTML = "<center><img src='http://d2c.bandcon.mogreet.com/images/sending_wht_loader.gif'></center>";
	//window.top.frames['video_iframe'].document.body.style.backgroundColor = "#FFF";
	if(document.send_form.terms.checked == false){
		$("form_error").innerHTML = agree_to_terms_text;
		$("loading_ani").innerHTML = "";
		$("form_error").style.display = "block";
	}
	else {
		clip_id = $("current_clip_id").value;
		from = $("from").value;
		from_name = $("giver").value;
		to = $("to").value;
		message = $("message").value;
		promo = $("promo").value;
		tnc = "true";
		flow_type = "replyY";	
		send_validation_test = "1";
		if(send_validation_test == "1"){send_mogreet2(campaign_id,clip_id,from,from_name,to,"",message,promo,player_key,player_val,"","parse_send_results");}
		else {alert("ISSUES");}
	}
}

function set_cookie(name,value){document.cookie = name + '=' + value +  ';';}

function get_cookie(name){
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;	
}

function page_manager(desired_page,passed_type) {
	pageTracker._trackPageview('/mogreet/page_change');
	current_view = get_cookie("current_view");
	if(passed_type == "grid"){
		current_view = "";
		use_page_count = grid_page_count;
	}
	else{
		current_view = "_list";
		use_page_count = list_page_count;
	}
	for(r=0;r<=use_page_count;r++){
		page_to_hide = "mogreets" + current_view + "_" + r;
		$(page_to_hide).style.display = "none";
	}

	page_to_show = (desired_page) - 1;	
	page_to_show = "mogreets"+ current_view + "_" + page_to_show;
	$(page_to_show).style.display = "block";
}

function post_send_action(){document.location = "sender.rb";}

function player_movie_end(){}

function clipboard_manager(raw_value,which_number){	
	normal_string = "";
	if(raw_value.length > 3){
		if(which_number == "to"){
			$("to_first_phone").value = "";
			$("to_second_phone").value = "";
			$("to_third_phone").value = "";
		}
		if(which_number == "from"){
			$("from_first_phone").value = "";
			$("from_second_phone").value = "";
			$("from_third_phone").value = "";
		}
		raw_value = raw_value.replace(" ","|");
		value_array = raw_value.split("");
		for(e=0;e<value_array.length;e++){
			if(!isInt(value_array[e])) {normal_string = normal_string + "";}
			else {normal_string = normal_string + value_array[e];}
		}
		normal_phone_1 = normal_string.substr(0,3);
		normal_phone_2 = normal_string.substr(3,3);
		normal_phone_3 = normal_string.substr(6,4);
		//$("normal_text").value = normal_string;
		if(which_number == "to"){
			$("to_first_phone").value = normal_phone_1;
			$("to_second_phone").value = normal_phone_2;
			$("to_third_phone").value = normal_phone_3;
		}
		if(which_number == "from"){
			$("from_first_phone").value = normal_phone_1;
			$("from_second_phone").value = normal_phone_2;
			$("from_third_phone").value = normal_phone_3;
		}
	}
}

function isInt(s) {
	var i;
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    return true;	
}

function track_number_value(number_type){
	constructed_to_number = $('to_first_phone').value + $('to_second_phone').value + $('to_third_phone').value;
	constructed_from_number = $('from_first_phone').value + $('from_second_phone').value + $('from_third_phone').value;
	$("to").value = constructed_to_number;
	$("from").value = constructed_from_number;
}

function $(id_name){
	id_obj = document.getElementById(id_name);
	return id_obj;
}

function set_style_display_block(obj){
	obj.style.display = 'block';
}

function set_style_display_none(obj){
	obj.style.display = 'none';
}

function store_self_send_preview_clip(){
	_temp = store_self_send_preview_clip.arguments[0];
	response = "";
	for ( _i = 0; _i < _temp.length; _i++ ){
	    if (_temp.charCodeAt(_i) != 13 && _temp.charCodeAt(_i) != 10){
			response += _temp.charAt(_i);
		}
	}
	self_send_preview['clip'] = eval('('+response+')');
	self_send_preview['clip'] = self_send_preview.clip[0].clip;
	set_home_preview_thumb();
}

function set_home_preview_thumb(){
	if ($('video_frame')){
		$('video_frame').innerHTML = '<img onmouseover="set_style_display_block($(\'play_btn_overlay\'));" onmouseout="set_style_display_none($(\'play_btn_overlay\'))" src="' + self_send_preview.clip.thumb + '" border="0" height="120" width="160">';
		$('text').innerHTML = self_send_preview.clip.title;
	} else {
		setTimeout("set_home_preview_thumb()",100);
	}
}

function set_home_preview_video(){
	flv = self_send_preview.clip.flv.name;
	flv_version = flv.slice(0,flv.lastIndexOf('.'));
	embed_code = '<object width="160" height="120" id="myspace_flv_player" align="middle" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="movie" value="http://www.mogreet.com/flash/' + flv_version + '/myspace_player_1.swf" /><embed src="http://www.mogreet.com/flash/' + flv_version + '/myspace_player_1.swf" width="160" height="120" name="myspace_flv_player" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'
	$('video_frame').innerHTML = embed_code;
	set_style_display_none($('play_btn_overlay'));
	preview_clip_id=flv_version.split("_")
	log_player2("play", campaign_id, preview_clip_id[0], player_key, player_val, "", "dummy");
}

function draw_init_content(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_browse_init_display(container_id){
	if(busy_flag == 0){
		self_send_flag = 0;
		if(container_id == "page_header"){new_html = page_header_html;$(container_id).innerHTML = new_html;new_html = "";}
		else if(container_id == "content"){new_html = content_html;$(container_id).innerHTML = new_html;new_html = "";}
		else if(container_id == "results"){
			busy_flag = 1;
			pageTracker._trackPageview('/mogreet/results_changed');
			$("clip_url").innerHTML = "";
			if(search_type == "key"){loader_source = "<center><img src='http://d2c.bandcon.mogreet.com/images/sending_wht_loader.gif'/></center>";}
			else{loader_source = "<center><img src='http://d2c.bandcon.mogreet.com/images/sending_wht_loader.gif'/></center>";}
			//new_html = "<div id='search_text'></div><div id='my_clips'></div><div id='loader'>" + loader_source + "</div>";
			new_html = "<div id='search_text'></div><div id='my_clips'></div>" + loader_source;
			$(container_id).innerHTML = new_html;
			new_html = "";
			if(search_string == "featured"){get_featured_clips("parse_search_results");}
			else if(search_string == "popular"){get_favorite_clips("parse_search_results");}
			else if(search_string == "recent"){get_recent_clips("parse_search_results");}
			else if(search_type == "cat"){get_by_clip_category(search_string,"parse_search_results");}
			else if(search_type == "id"){
				//load_first_clip(search_string);
				//Note: Hacked: ability to pass just clip_id or clip_id+version in doing so parse_clip_info calls load_first_clip
				passed_clip_id = search_string.split("_");
				get_by_clip_id(passed_clip_id[0],"parse_clip_info");
				if(f == "f"){get_featured_clips("parse_search_results");}
				else if(f == "fav"){get_favorite_clips("parse_search_results");}
				else if(f == "r"){get_recent_clips("parse_search_results");}
				else if(f == "key"){get_by_clip_rank(fs,"parse_search_results2()");}
				else if(f == "cat"){get_by_clip_category(fc,"parse_search_results");} 
				else if(f == ""){get_featured_clips("parse_search_results");}
				else {}
				self_send_flag = 1;
			}
			else if(search_type == "key"){get_by_clip_rank(search_string,"parse_search_results");}
			else if(search_string == "selfsend"){
				self_send_flag = 1;
				self_send_preview['clip'] = get_by_clip_id(self_send_preview['clip_id'],'store_self_send_preview_clip()','json');
				get_by_clip_rank(self_send_preview.search_string,"parse_search_results");
				/*select_category("cat_movies");*/
				search_string = self_send_preview.search_string;
				terms = "selfsend";
				load_first_clip("");
			}
			else{get_by_clip_rank(search_string,"parse_search_results");}
			redraw = 0;
			/*if(search_string == "movie"){
				new_title = "Movie Quotes";
				select_category('cat_movies');
				redraw = 1;
			}	
			if(search_string == "love"){
				new_title = "Love & Kisses";
				select_category('cat_love');
				redraw = 1;
			}	
			if(search_string == "birthday"){
				new_title = "Birthday Greetings";
				select_category('cat_birthday');
				redraw = 1;
			}
			if(search_string == "holidays"){
				new_title = "Holidays";
				select_category('cat_ny');
				redraw = 1;
			}
			if(search_string == "godfather"){
				new_title = "The GodFather";
				select_category('cat_movies');
				redraw = 1;
			}	
			if(search_string == "love"){
				new_title = "I Love You";
				select_category('cat_love');
				redraw = 1;
			}	
			if(search_string == "miss,you"){
				new_title = "I Miss You";
				select_category('cat_miss');
				redraw = 1;
			}	
			if(search_string == "sorry"){
				new_title = "I'm Sorry";
				select_category('cat_sorry');
				redraw = 1;
			}	
			if(search_string == "bdaysweet"){
				new_title = "Sweet Birthday";
				select_category('cat_birthday');
				redraw = 1;
			}	
			if(search_string == "funnybday"){
				new_title = "Funny Birthday";
				select_category('cat_birthday');
				redraw = 1;
			}
			if(search_string == "christmas"){
				new_title = "Christmas";
				select_category('cat_christmas');
				redraw = 1;
			}*/	
			if(redraw == 1){$('page_title').innerHTML = new_title;}		
		}
		else if(container_id == "container"){new_html = container_html;$(container_id).innerHTML = new_html;new_html = "";}
		else if(container_id == "leaderboard"){new_html = leaderboard_html;$(container_id).innerHTML = new_html;new_html = "";}
		else {new_html = 'Unknown Container ID';$(container_id).innerHTML = new_html;new_html = "";}	
		//$(container_id).innerHTML = new_html;
		//new_html = "";
	}
}

function draw_about_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_email_landing_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_forgot_password_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_terms_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_register_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_how_to_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_explore_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_contact_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_jobs_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_partners_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_investors_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_get_involved_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_team_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_history_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_agreement_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_download_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_faq_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_legal_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_legal_terms_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_guidelines_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_idea_factory_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_legal_terms_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_sitemap_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_phones_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_press_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_privacy_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_support_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_tech_specs_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_terms_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_what_is_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function draw_where_else_init_display(container_id){
	eval("new_html = " + container_id + "_html;");
	$(container_id).innerHTML = new_html;
}

function start_movie(path_name,title){
	pageTracker._trackPageview('/mogreet/preview_started');
	$('player_title').innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + title;
	new_html = '<object width="190" height="143" id="myspace_flv_player" align="middle">' + 
      		   '<param name="movie" value="' + preview_server + 'flash/' + path_name + '/myspace_player_1.swf" />' +
      		   '<embed src="' + preview_server + 'flash/' + path_name + '/myspace_player_1.swf" width="190" height="140" name="myspace_flv_player" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>' +
    		   '</object>';
	$('player_title').innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + title;
	if($("play_btn_overlay")){$("play_btn_overlay").innerHTML = "";}
	$("screen").innerHTML = new_html;
}

function show_log_in_box(){
	new_html = log_in_box_html;
	$("sign_in").innerHTML = new_html;
}

function try_it(){
	/*$('try_it').style.display = 'none';
	$('play_btn_overlay').style.display = 'none';*/
}

function update_browse_action_view(new_view){
	eval("$('form').innerHTML = action_content_" + new_view + "_private;");
	if(new_view == "send"){
		set_sender_price();
	}
}

function homepage_icon_rollovers(icon){
	icon_name = icon + "_icon";
	image_name = icon + "_image";
	$(icon_name).src = "images/categories_icon_" + icon + "_over.jpg";
	//$(image_name).src = "images/categories_" + icon + "_over.jpg";
}

function homepage_icon_rollouts(icon){
	icon_name = icon + "_icon";
	image_name = icon + "_image";
	$(icon_name).src = "images/categories_icon_" + icon + ".jpg";
	//$(image_name).src = "images/categories_" + icon + ".jpg";
}

function update_footer_style(){
	$("footer").style.backgroundColor = "";
}

function set_remaining_chars(){
	chars_remaining = 150;
	current_text = $("message").value.length;
	chars_left = chars_remaining - current_text;
	if(chars_left <= 0){
		$("message").value = $("message").value.substring(0,150);
		chars_left = 0;
	}
	$("remaining_chars").innerHTML = chars_left;
}

function list_view(page_count){
	for(t=0;t<=list_page_count;t++){
		working_div = "mogreets_list_" + t;
		if(t == 0){$(working_div).style.display = "block";}
		else {$(working_div).style.display = "none";}
	}
	for(t=0;t<=grid_page_count;t++){
		working_div = "mogreets_" + t;
		$(working_div).style.display = "none";
	}
	set_cookie("current_view","list");
}

function grid_view(page_count) {
	for(t=0;t<=list_page_count;t++){
		working_div = "mogreets_list_" + t;
		$(working_div).style.display = "none";
	}
	for(t=0;t<=grid_page_count;t++){
		working_div = "mogreets_" + t;
		if(t == 0){$(working_div).style.display = "block";}
		else{$(working_div).style.display = "none";}
	}
	set_cookie("current_view","grid");
}

function self_send_check(the_field){
	check_state = the_field.checked;
	if(check_state == true){$('to').value = $('from').value;}
	else{the_field.value = "";}
}

function draw_pagenation(new_html,page_count,specific_count,css,display_type,current_page){
	new_html = new_html + '<div id="pagination_' + css + '">';
	if(css == "top"){
		new_html = new_html + '<div id="view">' +
		       				  'View: <a href="#" onClick="list_view(' + list_page_count + ');"><img src="http://d2c.bandcon.mogreet.com/images/view_list.gif" border="0" /> List</a> | ' + 
			   				  '<a href="#" onClick="grid_view(' + grid_page_count + ');"><img src="http://d2c.bandcon.mogreet.com/images/view_grid.gif" border="0"> Grid</a>' + 
			   				  '</div>';
	}		
	new_html = new_html + '<div id="page">Page '; 	
	for(x=0;x<specific_count;x++){
		number_str = x + 1;
		if((current_page + 1) == number_str){number_str = "<span class='selected_page'>" + number_str + "</span>";}
		new_html = new_html + '<a href="#" onClick="page_manager(' + (x + 1) + ',\'' + display_type + '\');return false;"><span id="' + display_type + '_page_num_' + (x + 1) + '">' + number_str + '</span></a>';
		if((x+1)<specific_count){new_html = new_html + " | ";}
	}                  
    new_html = new_html + '</div></div>';
	return new_html;
}

function clear_to_marcom(){if($("receivernumber").value == "To Mobile #"){$("receivernumber").value = "";}}

function clear_msg_marcom(){if($("message").value == "Add Your Personal Message!"){$("message").value = "";}}

function clear_play_btn() {
	if($('play_btn_overlay')){$('play_btn_overlay').innerHTML = '';}
	window.top.frames['my_frame'].document.location = "player.rb?id=2";
}

function tab_manager(current_value,char_limit,next_div_id,evnt){
	if(!evnt){evnt = "0";}
	//alert(evnt.keyCode);
	if(evnt.keyCode != "9" && evnt.keyCode != "16"){if(current_value.length == char_limit){$(next_div_id).focus();}}
}

function limit_char(current_string,limit,forward_div_id){
	remaining_chars = limit - current_string.length;
	if($("name_limit")){$("name_limit").innerHTML = current_string.length;}
	if(current_string.length == limit){$("name_limit").focus();}
}

function select_category(span_name,new_title,passed_search_string){
	pageTracker._trackPageview('/mogreet/category_changed');
	if(busy_flag == 0){
		search_string = passed_search_string;
		clear_selected_category();
		$('page_title').innerHTML = new_title;
		search_type = 'key';
		$(span_name).setAttribute('class','selected_category');
		$(span_name).setAttribute('className','selected_category');
		draw_browse_init_display('results');
	}
}

function clear_selected_category(){
	$('cat_birthday').setAttribute('class','');
	$('cat_anniversary').setAttribute('class','');
	$('cat_congratulations').setAttribute('class','');
	$('cat_love').setAttribute('class','');
	$('cat_sorry').setAttribute('class','');
	$('cat_miss').setAttribute('class','');
	$('cat_breakup').setAttribute('class','');
	$('cat_call').setAttribute('class','');
	$('cat_where').setAttribute('class','');
	$('cat_thanks').setAttribute('class','');
	$('cat_religious').setAttribute('class','');
	$('cat_coffee').setAttribute('class','');
	$('cat_lunch').setAttribute('class','');
	$('cat_dinner').setAttribute('class','');
	$('cat_come').setAttribute('class','');
	$('cat_party').setAttribute('class','');
	//$('cat_celeb').setAttribute('class','');
	//$('cat_500days').setAttribute('class','');
	//$('cat_bethcooper').setAttribute('class','');
	//$('cat_12rounds').setAttribute('class','');
	$('cat_twilight').setAttribute('class','');
	//$('cat_loveguru').setAttribute('class','');
	//$('cat_notorious').setAttribute('class','');
	//$('cat_forrestgump').setAttribute('class','');
	//$('cat_howtoloseaguy').setAttribute('class','');
	//$('cat_juno').setAttribute('class','');
	//$('cat_slumdogmillionaire').setAttribute('class','');
	//$('cat_transformers').setAttribute('class','');
	//$('cat_topgun').setAttribute('class','');
	//$('cat_breakfastattiffanys').setAttribute('class','');
	//$('cat_footloose').setAttribute('class','');
	//$('cat_nacholibre').setAttribute('class','');
	//$('cat_napoleondynamite').setAttribute('class','');
	//$('cat_sideways').setAttribute('class','');
	//$('cat_marleyandme').setAttribute('class','');
	//$('cat_meangirls').setAttribute('class','');
	//$('cat_ironman').setAttribute('class','');
	//$('cat_28dayslater').setAttribute('class','');
	//$('cat_zoolander').setAttribute('class','');
	//$('cat_theclique').setAttribute('class','');
	//$('cat_jackass').setAttribute('class','');
	//$('cat_clueless').setAttribute('class','');
	//$('cat_election').setAttribute('class','');
	//$('cat_thegodfather').setAttribute('class','');
	//$('cat_spiderwickchronicles').setAttribute('class','');
	//$('cat_schoolofrock').setAttribute('class','');
	//$('cat_nakedgun').setAttribute('class','');
	//$('cat_grease').setAttribute('class','');
	//$('cat_southpark').setAttribute('class','');
	//$('cat_nightofthelivingdead').setAttribute('class','');
	//$('cat_superbowl').setAttribute('class','');
	//$('cat_vday').setAttribute('class','');
	//$('cat_groundhog').setAttribute('class','');
	//$('cat_aprilfools').setAttribute('class','');
	//$('cat_mardigras').setAttribute('class','');
	//$('cat_stpatricksday').setAttribute('class','');
	//$('cat_easter').setAttribute('class','');
	//$('cat_mothersday').setAttribute('class','');
	//$('cat_movies').setAttribute('class','');
	$('cat_birthday').setAttribute('className','');
	$('cat_anniversary').setAttribute('className','');
	$('cat_congratulations').setAttribute('className','');
	$('cat_love').setAttribute('className','');
	$('cat_sorry').setAttribute('className','');
	$('cat_miss').setAttribute('className','');
	$('cat_breakup').setAttribute('className','');
	$('cat_call').setAttribute('className','');
	$('cat_where').setAttribute('className','');
	$('cat_thanks').setAttribute('className','');
	$('cat_religious').setAttribute('className','');
	$('cat_coffee').setAttribute('className','');
	$('cat_lunch').setAttribute('className','');
	$('cat_dinner').setAttribute('className','');
	$('cat_come').setAttribute('className','');
	$('cat_party').setAttribute('className','');
	//$('cat_celeb').setAttribute('className','');
	//$('cat_500days').setAttribute('className','');
	//$('cat_bethcooper').setAttribute('className','');
	//$('cat_12rounds').setAttribute('className','');
	$('cat_twilight').setAttribute('className','');
	//$('cat_loveguru').setAttribute('className','');
	//$('cat_notorious').setAttribute('className','');
	//$('cat_forrestgump').setAttribute('className','');
	//$('cat_howtoloseaguy').setAttribute('className','');
	//$('cat_juno').setAttribute('className','');
	//$('cat_slumdogmillionaire').setAttribute('className','');
	//$('cat_transformers').setAttribute('className','');
	//$('cat_topgun').setAttribute('className','');
	//$('cat_breakfastattiffanys').setAttribute('className','');
	//$('cat_footloose').setAttribute('className','');
	//$('cat_nacholibre').setAttribute('className','');
	//$('cat_napoleondynamite').setAttribute('className','');
	//$('cat_sideways').setAttribute('className','');
	//$('cat_marleyandme').setAttribute('className','');
	//$('cat_meangirls').setAttribute('className','');
	//$('cat_ironman').setAttribute('className','');
	//$('cat_28dayslater').setAttribute('className','');
	//$('cat_zoolander').setAttribute('className','');
	//$('cat_theclique').setAttribute('className','');
	//$('cat_jackass').setAttribute('className','');
	//$('cat_clueless').setAttribute('className','');
	//$('cat_election').setAttribute('className','');
	//$('cat_thegodfather').setAttribute('className','');
	//$('cat_spiderwickchronicles').setAttribute('className','');
	//$('cat_schoolofrock').setAttribute('className','');
	//$('cat_nakedgun').setAttribute('className','');
	//$('cat_grease').setAttribute('className','');
	//$('cat_southpark').setAttribute('className','');
	//$('cat_nightofthelivingdead').setAttribute('className','');
	//$('cat_superbowl').setAttribute('className','');
	//$('cat_vday').setAttribute('className','');
	//$('cat_groundhog').setAttribute('className','');
	//$('cat_mardigras').setAttribute('className','');
	//$('cat_stpatricksday').setAttribute('className','');
	//$('cat_aprilfools').setAttribute('className','');
	//$('cat_easter').setAttribute('className','');
	//$('cat_mothersday').setAttribute('className','');
	//$('cat_movies').setAttribute('className','');
}

function reset_browse_send(){
	$("form_error").style.display = "none";
	$("to_first_phone").value = "";
	$("to_second_phone").value = "";
	$("to_third_phone").value = "";
	$("message").value = "";
	$("promo").value = "";
	$("to").value = "";
	$("clear_button").style.display = "none";
}

function image_preloader(){
	for (x=0; x<image_preloader.arguments.length; x++){
		preload_images[x] = new Image();
		preload_images[x].src = "images/" + image_preloader.arguments[x];
	}	
}

function validate_signin_form(){
	the_form = document.forms['signin_form'];
	send_flag = 1;
	the_msg = "Fix these fields to sign-in:\n";
	
	if($('username').value == ""){
		the_msg = the_msg + "Username\n";
		send_flag = 0;
	}
	
	if($('password').value == ""){
		the_msg = the_msg + "Password\n";
		send_flag = 0;
	}
	
	if(send_flag == 1){
		login($('username').value,$('password').value,"parse_log_in_results");
	}
	else{alert(the_msg);}
}

function validation_browse_send(){
	$("form_error").style.display = "none";
	giver = $("giver").value;
	to_1 = $("to_first_phone").value;
	to_2 = $("to_second_phone").value;
	to_3 = $("to_third_phone").value;
	from_1 = $("from_first_phone").value;
	from_2 = $("from_second_phone").value;
	from_3 = $("from_third_phone").value;
	msg =  $("message").value;
	 		
	if(giver == ""){
		$("giver").setAttribute("class","error");
		$("giver").setAttribute("className","error");
	}
	else {
		$("giver").setAttribute("class","input");
		$("giver").setAttribute("className","input");
	}
	
	if(to_1 == "" || to_2 == "" || to_3 == ""){
		
		$("to_first_phone").setAttribute("class","error");
		$("to_first_phone").setAttribute("className","error");
		$("to_second_phone").setAttribute("class","error");
		$("to_second_phone").setAttribute("className","error");
		$("to_third_phone").setAttribute("class","error");
		$("to_third_phone").setAttribute("className","error");
	}
	else {
		$("to_first_phone").setAttribute("class","input");
		$("to_first_phone").setAttribute("className","input");
		$("to_second_phone").setAttribute("class","input");
		$("to_second_phone").setAttribute("className","input");
		$("to_third_phone").setAttribute("class","input");
		$("to_third_phone").setAttribute("className","input");
	}
	
	if(msg == ""){
		$("message").setAttribute("class","error");
		$("message").setAttribute("className","error");
	}
	else {
		$("message").setAttribute("class","input");
		$("message").setAttribute("className","input");
	}
	
	if(from_1 == "" || from_2 == "" || from_3 == ""){
		$("from_first_phone").setAttribute("class","error");
		$("from_first_phone").setAttribute("className","error");
		$("from_second_phone").setAttribute("class","error");
		$("from_second_phone").setAttribute("className","error");
		$("from_third_phone").setAttribute("class","error");
		$("from_third_phone").setAttribute("className","error");
	}
	else {
		$("from_first_phone").setAttribute("class","input");
		$("from_first_phone").setAttribute("className","input");
		$("from_second_phone").setAttribute("class","input");
		$("from_second_phone").setAttribute("className","input");
		$("from_third_phone").setAttribute("class","input");
		$("from_third_phone").setAttribute("className","input");
	}
}

function isNumberKey(evt) {
		var charCode = (evt.which) ? evt.which : evt.keyCode
    	if (charCode > 31 && (charCode < 48 || charCode > 57))
 			return false;
		return true;
}

function isNumberKeyOrControl(evt) {
	if(evt.metaKey == false){
		var charCode = (evt.which) ? evt.which : evt.keyCode
    	if (charCode > 31 && (charCode < 48 || charCode > 57))
 			return false;
		return true;
	}
	else {
		return true;
	}
}

function validate_registration(){
	the_form = document.forms['register_form'];
	send_flag = 1;
	the_msg = "Fix these fields to register:\n";	
	if($('password').value == ""){
		the_msg = the_msg + "Password\n";
		send_flag = 0;
	}
	
	if($('password2').value != $('password').value){
		the_msg = the_msg + "Passwords do not match\n";
		send_flag = 0;
	}
	
	if($('mobile').value == ""){
		the_msg = the_msg + "Mobile Number\n";
		send_flag = 0;
	}
	
	if(send_flag == 1){
		phone = $('mobile').value;
		name = "notused";
		passwd = $('password').value;
		lang = "us";
		join(phone,name,passwd,lang,"parse_join_results");
		
	}
	else{alert(the_msg);}
}

function parse_transaction_data(){
	raw_response = parse_transaction_data.arguments[0];
	clip_id_start = raw_response.indexOf("<clip_id>");
	clip_id_stop = raw_response.indexOf("</clip_id>");
	clip_id = raw_response.substring(clip_id_start + 9,clip_id_stop);

	clip_flv_version_id_start = raw_response.indexOf("<clip_flv_version_id>");
	clip_flv_version_id_stop = raw_response.indexOf("</clip_flv_version_id>");
	clip_flv_version_id = raw_response.substring(clip_flv_version_id_start + 21,clip_flv_version_id_stop);
	
	load_clip_id = clip_id + "_" + clip_flv_version_id;
	
	givername_start = raw_response.indexOf("<givername>");
	givername_stop = raw_response.indexOf("</givername>");
	givername = raw_response.substring(givername_start + 11,givername_stop);
	$("givername").innerHTML = givername;
	
	clip_name_start = raw_response.indexOf("<clip_name>");
	clip_name_stop = raw_response.indexOf("</clip_name>");
	clip_name = raw_response.substring(clip_name_start + 11,clip_name_stop);
	$("clip_name").innerHTML = clip_name;
	
	message_start = raw_response.indexOf("<message>");
	message_stop = raw_response.indexOf("</message>");
	message = raw_response.substring(message_start + 9,message_stop);
	$("message").innerHTML = message;
	
	new_html = '<object width="320" height="240" id="myspace_flv_player" align="middle" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">' +
			   '<param name="movie" value="http://www.mogreet.com/flash/' + load_clip_id + '/myspace_player_1.swf" />' +
			   '<embed src="http://www.mogreet.com/flash/' + load_clip_id + '/myspace_player_1.swf" width="320" height="240" name="myspace_flv_player" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' +
			   '</object>';
	$('player').innerHTML = new_html;
}

