/*

	Copyright Bengosul @xxxynetwork.com
	
*/
var clipindex=0;
var totalClips=0;
var loopClips=true;

function srch_off(id){
	var o = document.getElementById(id);
	if (!o) {return;}
	if (o.value == '') {
		o.value='search...';
	}
}

function srch_on(id){
	var o = document.getElementById(id);
	if (!o) {return;}
	if (o.value == 'search...') {
		o.value='';
	}
}

function search_do(){
	var frm=document.forms[0];
	if (!frm) {return false;}
	frm.submit();
	return true;
}



function GUI_ready(){
	if (top.location != location) {
		top.location.href = document.location.href ;
	}
	window.moveTo(0,0);
	if (document.all) {
		top.window.resizeTo(screen.availWidth,screen.availHeight);
	}
	else if (document.layers||document.getElementById) {
		if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth) {
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
		}
	}
}
function bookmarksite(){
	if (document.all) {
		window.external.AddFavorite("http://www.hdporntubes.com/", "HD Porn Tubes");
	} else if (window.sidebar) {
		window.sidebar.addPanel("HD Porn Tubes", "http://www.hdporntubes.com/","")
	}
}

function mo(o){o.className=='stateoff'?o.className='stateon': o.className=o.className;}
function mx(o){o.className=='stateon'?o.className='stateoff': o.className=o.className;}
function mc(o){o.className='stateclicked';}
function preurlrew(obj,pre,url){
	if (obj!=null) {
		obj.href=pre+url;
		return true;
	} else {
		return false;
	}
}



function OnClipPlayEnded(idx) {
	//alert("Clip Index: "+idx+" has just ended");
	clipindex=++idx;
	custom_flipbg('clip'+clipindex,false,'#cccccc');
/*	clipindex++;
	if (clipindex==totalClips) {
		if (loopClips) {
			clipindex=1;
			custom_flipbg('clip'+clipindex,true,'#cccccc');
		}
	} else {
		custom_flipbg('clip'+clipindex,true,'#cccccc');
	}*/
	return false;
}

function OnClipPlayStarted(idx) {
	//alert("Clip Index: "+idx+" has just started");
	clipindex=++idx;
	custom_flipbg('clip'+clipindex,true,'#cccccc');
	return false;
}



function custom_flipbg (id,o,color) {
	var obj=document.getElementById(id);
	if (obj) {
		if (o) {
			obj.style.backgroundColor=color;	
		} else {
			obj.style.backgroundColor="";	
		}
	}
}

function OnSceneMouseOver(sceneid,o){
	var obj=document.getElementById('clip'+sceneid);
	if (obj) {
		if (o) {
			obj.style.backgroundColor="#1A1A1A";	
		} else {
			if (sceneid==clipindex) {
				obj.style.backgroundColor="#ffffff";
			} else {
				obj.style.backgroundColor="";	
			}
		}
	}		
}


function flipbg (id,o) {
	var obj=document.getElementById(id);
	if (obj) {
		if (o) {
			obj.style.backgroundColor="#1A1A1A";	
		} else {
			obj.style.backgroundColor="";	
		}
	}
}


function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}


function playClip(id) {
	id--;
	var movie=thisMovie('vplayer');
	if (movie==null) {return ;}
	movie.PlayClipCallBack(id);
}





var curIdx=1;
var maxIdx=6;
var SlidePlaying=false;
var TimerId = 0;
var media_host="";
var mpath="";
var msz="1";

function StartSlide(s,id,mp,fr) {
	if (SlidePlaying==false) {
		msz=s;
		media_host=mp;
		mpath=fr;
		curIdx=0;
		TimerId=setTimeout("ShowSlide('" +id+ "')", 800);
		SlidePlaying=true;
	}
}
function StopSlide(id,mp) {
	//restore
	clearTimeout(TimerId);
	curIdx=mp;
	document.getElementById(id).src=media_host+"c"+curIdx+msz+"_"+mpath+".jpg";
	
	TimerId=0;
	SlidePlaying=false;
	curIdx=0;
}
function ShowSlide(id){
	if (SlidePlaying==true) {
		if (curIdx==6) {
			curIdx=0;
		}
		
		document.getElementById(id).src=media_host+"c"+curIdx+msz+"_"+mpath+".jpg";
		TimerId=setTimeout("ShowSlide('"+id+"')", 400);
		curIdx++;
	}
}





