
function login()
{
	document.blip.submit();	
}

function show_flash(val) {
	
	var valimplode=val.split(",");
	var viewerid = valimplode[0];
	var vname = valimplode[1];
	//alert(vname);
	//alert(viewerid);
	
	/*change width and height in flash by sameena pre Wid=620 & hei=220*/
	   		
	        var w = "620";
			var h = "550";
			var swf_id = "mymoviename";
			var url ="http://sn.blipcam.com/appwebcam/newvideopoke.swf";
			var fvar_str = "userid="+viewerid+"&username="+vname;
			var  fvars = true;
		
			var embed_str = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"";
	        embed_str += "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\"";
	        embed_str += " width=\""+w+"\"";
	        embed_str += " height=\""+h+"\"";
	        embed_str += " id=\""+swf_id+"\">";
	        embed_str += "<param name=\"allowScriptAccess\" value=\"always\" />";
	        embed_str += "<param name=\"allowNetworking\" value=\"all\" />";
	        embed_str += "<param name=\"wmode\" value=\"opaque\" />";
	        embed_str += "<param name=\"movie\" value=\""+url+"\" />";
	        if (fvars) embed_str += "<param name=\"flashvars\" value=\""+fvar_str+"\" />";
	        embed_str += "<embed type=\"application/x-shockwave-flash\"";
	        embed_str += " allowScriptAccess=\"always\"";
	        embed_str += " allowNetworking=\"all\"";
	        embed_str += " wmode=\"opaque\"";
	        embed_str += " src=\""+url+"\"";
	        embed_str += " width=\""+w+"\"";
	        embed_str += " height=\""+h+"\"";
	        if (fvars) embed_str += " flashvars=\""+fvar_str+"\"";
	        embed_str += " name=\""+swf_id+"\">";
	        embed_str += "</embed></object>";
	
			document.getElementById("flashimg").style.display = "none";
	   		document.getElementById("flashplayer").innerHTML = embed_str;
	   		//gadgets.window.adjustHeight();
	
		
	
}
function showDiv()
{
	
document.getElementById('two_column_left_sidebar').style.display="block";	
//document.getElementById('two_column_left_sidebar').style.backgroundColor="green";	
}
function init()
{		 
 
   var formInputs = document.getElementsByTagName('input');
      for (var i = 0; i < formInputs.length; i++) {
          var theInput = formInputs[i];
        	
              if ((theInput.type == 'text' || theInput.type == 'password') && theInput.className.match(/\bcleardefault\b/)) {  
               /* Add event handlers */          
                 addEvent(theInput, 'focus', clearDefaultText, false);
                 addEvent(theInput, 'blur', replaceDefaultText, false);
                 
                 if (theInput.value != '') {
                theInput.defaultText = theInput.value;
            	}
        	}
    }
    
     xmlhttpPost("http://sn.blipcam.com/appwebcam/userprofile.php");
     
}
function clearDefaultText(e) {
    var target = window.event ? window.event.srcElement : e ? e.target : null;
    if (!target) return;
    
    if (target.value == target.defaultText) {
        target.value = '';
    }
}

function replaceDefaultText(e) {
    var target = window.event ? window.event.srcElement : e ? e.target : null;
    if (!target) return;
    
    if (target.value == '' && target.defaultText) {
        target.value = target.defaultText;
    }
}

 
function xmlhttpPost(strURL) {
	
	/*document.getElementById('week').style.display="none";
	document.getElementById('month').style.display="none";
	document.getElementById('today').style.display="none";
	document.getElementById('recent').style.display="block";
	
	document.getElementById('litag3').className="";
	document.getElementById('litag4').className="";
	document.getElementById('litag1').className="ui-tabs-selected";
	document.getElementById('litag2').className= "";*/

	
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
			
			updatepage(self.xmlHttpReq.responseText);
			
        }
    }
    self.xmlHttpReq.send(getquerystring());
}

function getquerystring() {
	
   qstr="w";
    return qstr;
}

function updatepage(str){
		

	var recparam_array = str.split(",");	
	var imgname_array = recparam_array[0].split("^");	
	var imgpath_array = recparam_array[1].split("^");	
    var day_array =     recparam_array[2].split("^");
    var hour_array =    recparam_array[3].split("^");
    var min_array =  recparam_array[4].split("^");
    var sec_array =  recparam_array[5].split("^");
    var frname_array = recparam_array[6].split("^");
    var msg = recparam_array[7].split("^");
	
	var count = imgname_array.length;
	var t=count;
	
	listvideo = new Array();
		
		created = "Created";
        by = "By";
		sent = "Sent";
		ago = "ago";
		SendComment = "Send Comment";
		MorePokes = "More Pokes";
		
	for(var g=0;g<count;g++){	
			    //count--;
            if(parseInt(sec_array[g]) > 60) {
		          if(parseInt(min_array[g]) > 60) {
			         if(parseInt(hour_array[g]) > 24) {
                        shtime = day_array[g] + " days "+ago;
			         } else {
                            shtime = hour_array[g] + " hours "+ago;
			         }
			       } else {
			           shtime = min_array[g] + " minutes "+ago;
			       }
			    }  else {
			     shtime =   sec_array[g] + " seconds "+ago;
			    }
			    
			    var img_str = imgname_array[g].split(' ').join('');
				 var imgstr = "'"+ imgpath_array[g] + (img_str.replace(/\n/g, ""))+"'"; 
				 var usrname = frname_array[g].split(' ').join('');
				 var uname_cl = usrname.replace(/\n/g, "");
				 //var strusrid =  "'"+usrid[g]+ "'";
			   					
				
				//listvideo.push('<span style="float:left;width:90px;margin:12px;height:130px;text-align:left;margin-top:25px;"><div><img src="' + imgpath_array[g]+imgname_array[g] + '" width="90" height="90" onclick="sharerecentvideo_friends('+imgstr+');" style="cursor:pointer;cursor:hand"/></div><div style="margin-top:5px;"><p style="font-weight:bold;font-family:tahoma;"> '+shtime+'</p><p><hr style="height:2px;"/></p><p style="color:#000066;">'+by+': '+uname_cl+'</p></div></span>');
				
		listvideo.push('<img src="' + imgpath_array[g]+imgname_array[g] + '" width="85" height="85" alt=""/>');
				
    }
    document.getElementById("recent").innerHTML = listvideo.join('');

	 newmemAjax("http://sn.blipcam.com/appwebcam/newmem.php");
	 
}

function newmemAjax(strURL) {
	
	var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
			
			newmemRes(self.xmlHttpReq.responseText);
			
        }
    }
    self.xmlHttpReq.send(getqrynewmem());
}

function getqrynewmem() {
	
   qstr="n";
    return qstr;
}

function newmemRes(str){
		
	var recparam_array = str.split(",");	
	var img_array = recparam_array[0].split("^");
	var user_array = recparam_array[1].split("^");
		
	var t=img_array.length;
	listvideo = new Array();
	
	for(var g=0;g<t;g++){			   					
				
				//listvideo.push('<span style="float:left;text-align:left;margin:10px;"><div><img src="' + img_array[g]+'" width="40" height="40"></div></span>');
				
			//listvideo.push('<span style="float:left;text-align:left;margin:10px;"><div><img src="' + img_array[g]+'" width="40" height="40"><p style="font-weight:bold;font-family:tahoma;margin-top:5px;">'+user_array[g]+'</p></div></span>');
				
	listvideo.push('<div style="float:left;margin-left:2px;margin-bottom:0px;overflow:hidden;width:40px;height:55px;"><img src="' + img_array[g]+'" width="40" height="40"><br><small>'+user_array[g]+'</small></div>');
				
    }
    document.getElementById("newmemlist").innerHTML = listvideo.join('');	
	
}

function weekAjax(strURL) {

	document.getElementById('month').style.display="none";
	document.getElementById('today').style.display="none";
	document.getElementById('week').style.display="block";
	
	document.getElementById('litag3').className="";
	document.getElementById('litag2').className="";
	document.getElementById('litag1').className= "active";
	
			
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
			
            Weekactive(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(getquerystringweek());
}
function getquerystringweek() {
	
   qstr="p";
    return qstr;
}
function Weekactive(str)
{
	
	var recparam_array = str.split(",");    
    var user_count = recparam_array[0].split("^");
    var frname_array = recparam_array[1].split("^");
    var imgname_array = recparam_array[2].split("^");
    var imgpath_array = recparam_array[3].split("^");
    var UserId = recparam_array[4].split("^");
	
	listvideoact = new Array();
	var count=imgpath_array.length;
	created = "Created";
        by = "By";
		sent = "Sent";
		ago = "ago";
		Alltime ="ALL TIME ACTIVE";
		
		for(var g=0;g<count;g++){	
			    //count++;
			 var struid = "'"+ UserId[g] + "'";			 
		
		    	listvideoact.push('<span style="float:left;width:200px;margin:20px;height:240px;margin-top:25px;"><div><img src="'+ imgpath_array[g]+imgname_array[g]+'" width="200" height="200" /></div><div style="text-align:left;width:95px;margin-bottom:5px;margin-top:5px;"><p style="font-weight:bold;font-family:tahoma;margin-top:5px;">'+frname_array[g]+' ('+(user_count[g])+')</p></div></span>');		    	
				
    }        
     	document.getElementById('week').innerHTML = listvideoact.join('');
}

function monthAjax(strURL) {

	document.getElementById('week').style.display="none";
	document.getElementById('today').style.display="none";
	document.getElementById('month').style.display="block";
	
	document.getElementById('litag3').className="";
	document.getElementById('litag2').className="active";
	document.getElementById('litag1').className= "";
	
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
			
            Monthactive(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(getqrymonth());
}
function getqrymonth() {
	
   qstr="p";
    return qstr;
}
function Monthactive(str)
{
	var recparam_array = str.split(",");    
    var user_count = recparam_array[0].split("^");
    var frname_array = recparam_array[1].split("^");
    var imgname_array = recparam_array[2].split("^");
    var imgpath_array = recparam_array[3].split("^");
    var UserId = recparam_array[4].split("^");
	
	listvideoact = new Array();
	var count=imgpath_array.length;
	created = "Created";
        by = "By";
		sent = "Sent";
		ago = "ago";
		Alltime ="ALL TIME ACTIVE";
		
		for(var g=0;g<count;g++){	
			    //count++;
			 var struid = "'"+ UserId[g] + "'";			 
		
		    	listvideoact.push('<span style="float:left;width:200px;margin:20px;height:240px;margin-top:25px;"><div><img src="'+ imgpath_array[g]+imgname_array[g]+'" width="200" height="200" /></div><div style="text-align:left;width:95px;margin-bottom:5px;margin-top:5px;"><p style="font-weight:bold;font-family:tahoma;margin-top:5px;">'+frname_array[g]+' ('+(user_count[g])+')</p></div></span>');		    	
				
    }        
     	document.getElementById('month').innerHTML = listvideoact.join('');
	
}

function todayAjax(strURL) {
	
	document.getElementById('week').style.display="none";
	document.getElementById('month').style.display="none";
	document.getElementById('today').style.display="block";
	
	document.getElementById('litag3').className="active";
	document.getElementById('litag2').className="";
	document.getElementById('litag1').className= "";
	
	
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
			
			Todayactive(self.xmlHttpReq.responseText);
			
        }
    }
    self.xmlHttpReq.send(getqrytoday());
}
function getqrytoday() {
	
   qstr="t";
    return qstr;
}
function Todayactive(str)
{
	
	var res=str;
	if(res == 0)
	{			
			document.getElementById('today').innerHTML = "No Pokes Found....";
	}
	else
	{
		var recparam_array = str.split(",");    
		var user_count = recparam_array[0].split("^");
		var frname_array = recparam_array[1].split("^");
		var imgname_array = recparam_array[2].split("^");
		var imgpath_array = recparam_array[3].split("^");
		var UserId = recparam_array[4].split("^");
		
		listvideoact = new Array();
		var count=imgpath_array.length;
		created = "Created";
			by = "By";
			sent = "Sent";
			ago = "ago";
			Alltime ="ALL TIME ACTIVE";
		
				for(var g=0;g<count;g++){	
						//count++;
					 var struid = "'"+ UserId[g] + "'";			 
				
						listvideoact.push('<span style="float:left;width:200px;margin:20px;height:240px;margin-top:25px;"><div><img src="'+ imgpath_array[g]+imgname_array[g]+'" width="200" height="200" /></div><div style="text-align:left;width:95px;margin-bottom:5px;margin-top:5px;"><p style="font-weight:bold;font-family:tahoma;margin-top:5px;">'+frname_array[g]+' ('+(user_count[g])+')</p></div></span>');		    	
						
			}        
				document.getElementById('today').innerHTML = listvideoact.join('');
	
	}
	
}

var popupWindow=null;
function popup(mypage,myname,w,h,pos,infocus){

if (pos == 'random')
{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
else
{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';popupWindow=window.open('',myname,settings);
if(infocus=='front'){popupWindow.focus();popupWindow.location=mypage;}
if(infocus=='back'){popupWindow.blur();popupWindow.location=mypage;popupWindow.blur();}

}