

//
//	Resize <iframe> if it exists.
//

function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	} 
};

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
		if((thisfield.id == 'photo_username') || (thisfield.id == 'video_username') ){

		}
	}
};

function viewziResizeModal()
{
	if (viewzi_timer)
	{
		return;
	}
	
	viewzi_ResizeModal();
	var viewzi_timer = setTimeout(function(){viewzi_timer = 0;}, 500);
}
var viewziSizes = {new_height: 0, old_height: 0, new_width: 0, old_width: 0};
function viewzi_ResizeModal()
{
	var w = document.getElementById('viewzi_wrapper');

	if (w)
	{
		// document.getElementById('viewzi_viewport').style.height = '';

		viewziSizes.new_height = document.documentElement.offsetHeight;
		viewziSizes.new_width = document.documentElement.offsetWidth;

		if (viewziSizes.new_height === viewziSizes.old_height && viewziSizes.new_width === viewziSizes.old_width)
		{
			return;
		}

		viewziSizes.old_height = viewziSizes.new_height;
		viewziSizes.old_width = viewziSizes.new_width;

		viewziSize();
	}
}

function viewziSize(){
	if (typeof ActiveXObject !== 'undefined')
	{
		var h = document.documentElement.offsetHeight;
		document.getElementById('viewzi_wrapper').style.width = document.documentElement.offsetWidth + 'px';
		document.getElementById('viewzi_wrapper').style.height = h + 'px';
		h = h - 49;
		if(viewziIE6){
			h = h - 20;
		}
		document.getElementById('viewzi_viewport').style.height = h + 'px';
	}
	else
	{
		var h = document.getElementById('viewzi_wrapper').offsetHeight;
		document.getElementById('viewzi_viewport').style.height = (h - 49) + 'px';
	}
}

function viewziPosition(){
	var docTop = document.body.scrollTop || document.documentElement.scrollTop;
	var w = document.getElementById('viewzi_wrapper');
	if(docTop > 0){
		w.style.top = docTop + 'px';
	} else if (w.style.top){
		w.style.top = '0px';
	}
}


/* Event listener. */
if (window.addEventListener)
{
	window.addEventListener('resize', viewziResizeModal, false);
}
else
{
	window.attachEvent('onresize', viewziResizeModal);
}

//
//	Hide the modal window.
//

function viewziHideModal()
{
	clearInterval(viewziPositionInterval);
	var w = document.getElementById('viewzi_wrapper');
	w.parentNode.removeChild(w);
	delete w;
}

//
//	Show modal on submit.
//
var viewziPositionInterval;
var viewziIE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;
function viewziShowModal()
{
	if (document.getElementById('viewzi_input').value)
	{
		if(viewziIE6){
			viewziPositionInterval = setInterval(viewziPosition, 100);
		}
		var thisdate= new Date();
		var now= thisdate.getSeconds();
		
		var src = 'http://www.viewzi.com/vfp.php?vfp_id=bfb6422c9154&t='+ now +'&v=blog_view&q=' + encodeURIComponent(document.getElementById('viewzi_input').value);
		
		var	modal_html =	'<div id="viewzi_overlay"></div>';
			modal_html +=	'<table id="viewzi_modal" cellspacing="0">';
			modal_html +=		'<thead>';
			modal_html +=			'<tr>';
			modal_html +=				'<td>';
			modal_html +=					'<span id="viewzi_title"><a href="http://www.viewzi.com/"></a> Search The Viddler Blog</span>';
			modal_html +=				'</td>';
			modal_html +=				'<td>';
			modal_html +=					'<span onclick="viewziHideModal()" id="viewzi_close">CLOSE</span>';
			modal_html +=				'</td>';
			modal_html +=			'</tr>';
			modal_html +=		'</thead>';
			modal_html +=		'<tbody>';
			modal_html +=			'<tr>';
			modal_html +=				'<td colspan="2" id="viewzi_viewport" style="height:500px">';
			modal_html +=					'<iframe id="viewzi_iframe" style="overflow-x:none; overflow-y:auto;" frameborder="0" src="' + src + '"></iframe>';
			modal_html +=				'</td>';
			modal_html +=			'</tr>';
			modal_html +=		'</tbody>';
			modal_html +=	'</table>';

		var	modal_wrap = document.createElement('div');
			modal_wrap.id = 'viewzi_wrapper';
			modal_wrap.innerHTML = modal_html;

		document.body.appendChild(modal_wrap);

		viewziSize();
	}
}

document.write('<style type="text/css">#viewzi_form,#viewzi_form *,#viewzi_modal,#viewzi_modal *{border:0;margin:0;outline:0;padding:0}#viewzi_input{background:#fff;border:1px solid;border-color:#000 #666 #999 #333;color:#333;font:12px Arial,sans-serif;margin:0 5px 0 0;padding:1px 3px 0;vertical-align:middle;width:140px;height:17px}#viewzi_button{background:#eee;border:1px solid;border-color:#ccc #666 #333 #999;color:#333;font:11px Arial,sans-serif;vertical-align:middle;width:60px;height:20px}#viewzi_wrapper{margin:0 auto;position:fixed;top:0;left:0;right:0;bottom:0;width:100%;height:100%;z-index:999999999}* html #viewzi_wrapper{position:absolute}#viewzi_overlay{background:#000;opacity:0.6;filter:alpha(opacity = 60);position:absolute;top:0;left:0;width:100%;height:100%;z-index:999999999}#viewzi_modal{background:#fff;border:1px solid #555;color:#444;font:bold 11px Arial,sans-serif;position:absolute;top:10px;left:5%;width:90%;z-index:999999999}#viewzi_modal a{text-decoration:none}#viewzi_modal td{vertical-align:top}#viewzi_modal thead td{background:#ccc url(http://www2.viewzi.com/images/vfp/viewzi_sprite.jpg) repeat-x 0 -26px;border-bottom:1px solid #777;height:26px}#viewzi_title{background:url(http://www2.viewzi.com/images/vfp/viewzi_sprite.jpg) no-repeat;display:inline;float:left;line-height:26px;position:relative;margin:0 0 0 10px;padding:0 0 0 62px;overflow:hidden;height:26px}#viewzi_title a{font-size:0;position:absolute;top:0;left:0;text-indent:-99999px;width:52px;height:26px}#viewzi_iframe{display:block;overflow:auto;width:100%;height:100%}#viewzi_close{font-weight:bold;cursor:pointer;display:inline;float:right;line-height:26px;margin:0 10px 0 0;overflow:hidden;height:26px}</style><form id="viewzi_form" onsubmit="viewziShowModal(); this.blur(); return false;"><div><input type="text" id="viewzi_input" onclick="clickclear(this, \'Search With Viewzi\')" onblur="clickrecall(this, \'Search With Viewzi\')" value="Search With Viewzi" /><input type="submit" id="viewzi_button" value="SEARCH" /></div></form>');
// production2:production2(20100208084834.u) - build  
