//JS Document

function share(s) {
	var u = escape(window.location);
	var t = escape(document.title);
	var l = u;
	switch(s) {
		case 'digg':        l = 'http://digg.com/submit?title=' + t + '&url=' + u; break;
		case 'delicious':   l = 'http://del.icio.us/post?title=' + t + '&url=' + u; break;
		case 'technorati':  l = 'http://www.technorati.com/faves?add=' + u; break;
		case 'yahoo':       l = 'http://myweb2.search.yahoo.com/myresults/bookmarklet?title=' + t + '&u=' + u; break;
		case 'stumbleupon': l = 'http://www.stumbleupon.com/submit?title=' + t + '&url=' + u; break;
		case 'google':      l = 'http://www.google.com/bookmarks/mark?op=add&title=' + t + '&bkmk=' + u; break;
	}
	document.location = l;
}

function stpLink() {
	var title = escape(document.title);
	var url = window.location;
	var new_loc = '/mail/mail_form.php?title='+ title + '&loc=' + url;
	window.location = new_loc;
	return;
}

function buy(x) {
	document.form1.prodid.value=x;
	document.form1.submit();
	return;
}

function openNL(itemid) {
	var winwidth = 668;
	var winheight = 550;
	var url = '/newsletter/items.php?id=' + itemid;
	window.open(url,'name','height=' + winheight + ',width=' + winwidth + ', scrollbars=1');
	return;
}

function openPracDay() {
	var winwidth = 668;
	var winheight = 550;
	var url = '/practices/practiceofday.php';
	window.open(url,'name','height=' + winheight + ',width=' + winwidth + ', scrollbars=1');
	return;
}

function gift(x) {
	document.form1.action = '/store/usergift.php';
	document.form1.prodid.value=x;
	document.form1.submit();
}

oc=0;
fg=0;

function capit(w) {
	capLetter=w.charAt(0).toUpperCase();
	return capLetter+w.substring(1,w.length);
}

function populateMenu(m){
	dr='/streams/asx/';
	ar='<img src="images/clipArrow.gif" width="6" height="7" alt="" align="absmiddle">';
	endStr='<div>'+capit(m)+'</div>';
	endStr+='Choose your<br>connection speed:<br><img src="/images/clr.gif" width="5" height="5"><br>';
	endStr+=ar+'<a href="'+dr+m+'H.asx">High</a> ';
	endStr+='<span>T1/T3</span><br>';
	endStr+=ar+'<a href="'+dr+m+'M.asx">Medium</a> ';
	endStr+='<span>Cable, DSL</span><br>';
	endStr+=ar+'<a href="'+dr+m+'L.asx">Low</a> ';
	endStr+='<span>56k, Dial-Up</span>';
	return endStr;
}

function openClip(c){
	closeAllClips();
	targetMenu=document.getElementById(c).getElementsByTagName('div')[0];
	targetMenu.innerHTML=populateMenu(c);
	targetMenu.style.visibility='visible';
	oc=1;
}

function hideClip(){
	if(oc){
		timer=setTimeout('closeAllClips()',300);
		fg=1;
	}
}

function keepClip(){
	if(fg){
		clearTimeout(timer);
		fg=0;
	}
}

function closeAllClips(){
	allClips=document.getElementsByTagName('div');
	for (i in allClips){
		if(allClips[i].className=='vidClip')
			allClips[i].getElementsByTagName('div')[0].style.visibility='hidden';
	}
	oc=0;
}

function enlarge(i){
 window.open('/blankpop.html?'+i, 'enlarge', 'width=665,height=633,scrollbars=no,statusbar=no,directories=no,menubar=no,resizeable=no');
}

function launchGallery(l){
 window.open(l, 'gallery', 'width=665,height=633,scrollbars=no,statusbar=no,directories=no,menubar=no,resizeable=no');
}

function openPopup(t, u) {
	t = t.toLowerCase();
	switch(t) {
		case 'fiql':
			window.open('/popups.php?t=fiql&u=' + u,'FIQLtv','width=665,height=600,scrollbars=no,statusbar=no,directories=no,menubar=no,resizeable=no');			
			break;
		case 'youtube':
			window.open('/popups.php?t=youtube&u=' + u,'YouTube','width=665,height=600,scrollbars=no,statusbar=no,directories=no,menubar=no,resizeable=no');		
			break;
		case 'slide':
			window.open('/popups.php?t=slide&u=' + u,'Slide','width=665,height=600,scrollbars=no,statusbar=no,directories=no,menubar=no,resizeable=no');		
			break;
		default:
			alert('Wrong type, expected: fiql, youtube or slide');
			break;
	}
}