
var _sendto_over = new Array(false,false,false);
var _sendto_mobile_t = null;
var _sendto_url1 = "";
var _sendto_type = "vid";
var _sendto_url2 = "";

function sendtomobile_onload() {
	_sendto_over[0] = true;
//	document.getElementById('sendtomobile_main_div').style.display = 'block';
//	document.getElementById('sendtomobile_main_div').src = 'http://'+_sendto_url1+"/send_to_mobile_iframe.html?"+_sendto_type+"="+_sendto_url2;
	document.getElementById('sendtomobile_main_div').focus();
}

function sendtomobile(mybtn, myurl1, mytype, myurl2) {
	var mywidth = 125;
	if (mybtn.match("86x16"))
		mywidth = 86;
	else if (mybtn.match("16x16"))
		mywidth = 16;
	if (mybtn.match(/^btn_/))
		mybtn = mybtn.replace(/^btn_/,"");

	myurl1 = myurl1.replace(/^http:\/\//i,"");
	_sendto_url1 = myurl1;
	_sendto_type = mytype;
	_sendto_url2 = myurl2;
	document.write ('<div style="position: relative; float: left; padding: 0; margin: 0; z-index: 32765; overflow:visible;" dir="ltr" align="left">');
	//document.write ('<iframe src="javascript:false" style="position: absolute; top: 16px; left: 0; display: none; width: 215px; height: 195px; z-index: 32766;" frameborder="0" scrolling="no" id="sendtomobile_fake_iframe" width="215" height="195"></iframe>');
	document.write ('<iframe src="');
	//document.write ("http://"+_sendto_url1+"/send_to_mobile_iframe.html?"+_sendto_type+"="+_sendto_url2);//about:blank
	document.write ("http://80.179.153.116/send_to_mobile_iframe.html?url="+escape(_sendto_url1)+"&"+_sendto_type+"="+_sendto_url2);
	document.write ('" frameborder="no" scrolling="no" width="1" height="1" style="direction: ltr; display: none; position: absolute; border: 0; top: 16px; left: 0; z-index: 32767;" id="sendtomobile_main_div" onmouseover="sendtomobile_open(2)" onmouseout="sendtomobile_close(2)"></iframe>');
	document.write ('<a href="javascript: void(0);" onclick="window.open('+"'http://"+_sendto_url1+'/c/send_mobile_content?'+_sendto_type+'='+_sendto_url2+"', '_SENDTOMOBILE', 'width=380, height=425, titlebar=1, resizable=1, scrollbars=0, address=0');"+'" onmouseover="sendtomobile_open(1);" onmouseout="sendtomobile_close(1);"><img src="http://80.179.153.116/images/sendto/'+mybtn+'.gif" width="'+mywidth+'" id="send_to_mobile_btn" height="16" border="0" alt="Send to mobile" /></a>');
	document.write ('</div>');
}

function sendtomobile_open(num) {
	try {
		if (!document.getElementById('sendtomobile_main_div'))
			return false;

		if (!_sendto_over[0])
			sendtomobile_onload();
	} catch (err) { }

/*		try {
			if (document.getElementsByTagName('embed'))
				if (document.getElementsByTagName('embed').length)
					for (i=0; i<document.getElementsByTagName('embed').length; i++) {
						document.getElementsByTagName('embed')[i].wmode='transparent';
					}
				else if (document.getElementsByTagName('embed').style) {
					document.getElementsByTagName('embed').wmode='transparent';
				}
		} catch(err) { }
*/
	try {
		//document.getElementById('sendtomobile_fake_iframe').style.display='block';
		document.getElementById('sendtomobile_main_div').style.display = 'block';
	} catch (err) { }
/*	try {
		document.getElementById('sendtomobile_main_div').focus();
	} catch (err) { }
*/	try {
		document.getElementById('sendtomobile_main_div').style.width='215px';
		document.getElementById('sendtomobile_main_div').style.height='195px';
		document.getElementById('sendtomobile_main_div').width='215px';
		document.getElementById('sendtomobile_main_div').height='195px';
		_sendto_over[num] = true;
		if (_sendto_mobile_t) {
			clearTimeout(_sendto_mobile_t);
			_sendto_mobile_t = null;
		}
	} catch(err) { }
}

function sendtomobile_close(num) {
	try {
		_sendto_over[num] = false;
		if (!_sendto_over[1] && !_sendto_over[2] && !_sendto_mobile_t)
			_sendto_mobile_t = setTimeout("sendtomobile_close2()",700);
	} catch(err) { }
}

function sendtomobile_close2() {
	try {
		if (_sendto_mobile_t) {
			clearTimeout(_sendto_mobile_t);
			_sendto_mobile_t = null;
		}
		if (!_sendto_over[1] && !_sendto_over[2]) {
			document.getElementById('sendtomobile_main_div').width='1px';
			document.getElementById('sendtomobile_main_div').height='1px';
			document.getElementById('sendtomobile_main_div').style.width='1px';
			document.getElementById('sendtomobile_main_div').style.height='1px';
			//document.getElementById('sendtomobile_main_div').style.display = 'none';
			//document.getElementById('sendtomobile_fake_iframe').style.display='none';
			//document.getElementById('sendtomobile_main_div').blur();
		}
	} catch(err) { }
}

