var SiteUrl="http://www.mysportstory.com/"; 
//var SiteUrl="http://192.168.0.123/sportsstory/"; 
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

function chklogin()
{
	if((document.getElementById("username").value=="") || (document.getElementById("username").value=="username"))
	{
		alert("Please Enter Username!")
		document.getElementById("username").focus();
		return false;
	}
	
	if(document.getElementById("password").value=="")
	{
		alert("Please Enter password!")
		document.getElementById("password").focus();
		return false;
	}
return true;
}

function show_state(cid)
{
	url = "state_box.php?cityid="+cid+"&show=registration";
	showit(url,"state")	;
}

/////////////////////common libraries         ////////////

function $id(element) 
		{
			//function for getting element id
			if (typeof element == 'string')
			element = document.getElementById(element);
			return element;
		}


function isBlank(id)
		{	//function to check is value blank		
		if($id(id).value=="") return  true; else	return false;
		}
			
			
			
function isBlankFocus(id,message)
		{	//function to check is value blank and focus with return false		
			if($id(id).value=="")
				{  
				alert(message);
				$id(id).focus();
				return  true;
				}
		}
			
			
			
function isValidEmail(value)
			{	//function to check is email address valid	
				if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(value)))
				return false;
				else
				return true;
			}
			
function isvalidphoto(thisfile)
 {
 //function to check is valid image type valid	
 var fileext = new Array ('.jpg', '.gif', '.jpeg', '.png', '.bmp', '.tif');
 	if(thisfile!="")
		{		
					var fileOK = 0;
					var aa = thisfile.substr(thisfile.indexOf('.'));
					var bb = aa.toLowerCase()
					for (j = 0; j < fileext.length; j++)
					{
							if(bb==fileext[j])
							{
								return true;
								break;
							}
					}
		}

	return false;
	
 }		
 
function switchDiv(divid)
			{
				if($id(divid).style.display=='')
				$id(divid).style.display='none';
				else
				$id(divid).style.display='';
				
			}

function ReverseCss(id)
	{//function to change navigation css
		if(id.className=='TitleTextNew_ro')
		id.className='TitleTextNew';
		else
		id.className='TitleTextNew_ro';
	}
	
function switchDivOn(divid)
			{
				$id(divid).style.display='';
				
			}
			
function switchDivOff(divid)
			{
				$id(divid).style.display='none';
				
			}
function isProper(val,fieldLabel)
	{
	var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
	  for (var i = 0; i < val.value.length; i++)
	  {
		if (iChars.indexOf(val.value.charAt(i)) != -1)
		{
		alert (fieldLabel+" is not allowed to have special characters");
		return false;
		}
	  }
	  return true;
	}
	
// {{{ explode
function explode( delimiter, string ) {
    // Split a string by string
    // *     example 1: explode(' ', 'DD Agarwal');
    // *     returns 1: {0: 'DD', 1: 'van', 2: 'Zonneveld'}

    var emptyArray = { 0: '' };

    if ( arguments.length != 2
        || typeof arguments[0] == 'undefined'
        || typeof arguments[1] == 'undefined' )
    {
        return null;
    }

    if ( delimiter === ''
        || delimiter === false
        || delimiter === null )
    {
        return false;
    }

    if ( typeof delimiter == 'function'
        || typeof delimiter == 'object'
        || typeof string == 'function'
        || typeof string == 'object' )
    {
        return emptyArray;
    }

    if ( delimiter === true ) {
        delimiter = '1';
    }

    return string.toString().split ( delimiter.toString() );
}// }}}


// {{{ in_array
function in_array(needle, haystack, strict) {
    // Checks if a value exists in an array
    // 
    // +    discuss at: http://DD.Agarwal.net/techblog/article/javascript_equivalent_for_phps_in_array/
    // +       version: 803.2519
    // +   original by: DD Agarwal (http://DD.Agarwal.net)
    // *     example 1: in_array('van', ['DD', 'van', 'Zonneveld']);
    // *     returns 1: true

    var found = false, key, strict = !!strict;

    for (key in haystack) {
        if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
            found = true;
            break;
        }
    }

    return found;
}// }}}

String.prototype.trim = function () {
  return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
};
function validate_video(frm)
{
	
	if(document.getElementById('Title').value=="")
	{
		alert("Please enter Video Title.");	
		document.getElementById('Title').focus();
		return false;
	}
	if(document.getElementById('CatID').value=="")
	{
		alert("Please enter Video Category.");	
		document.getElementById('CatID').focus();
		return false;
	}
	
	if(document.getElementById('Description').value=="")
	{
		alert("Please enter Video Description.");	
		document.getElementById('Description').focus();
		return false;
	}
	if(document.getElementById('Embedcode').value=="" && document.getElementById('Video_url').value=="" )
	{
		alert("Please enter Youtube Embedcode OR video Url.");	
		document.getElementById('Embedcode').focus();
		return false;
	}
	if(document.getElementById('Embedcode').value!="")
	{ 
		var newText = document.getElementById('Embedcode').value;
		embStart = newText.indexOf("<embed>");
		embEnd = newText.indexOf("</embed>");
		
		if((embStart == -1 && embEnd == -1))
		{
			alert("Please enter a valid video embed code.");
			document.getElementById('Embedcode').focus();
			return false;
		}	
	document.getElementById('Embedcode').value= encodeURI(document.getElementById('Embedcode').value);
		//return  document.frm.Embedcode.value;
		//alert(document.getElementById('Embedcode').value);
		return true;
	}
	if(document.getElementById('Video_url').value!='')
	{
		var theurl=document.getElementById('Video_url').value;
		var tomatch= /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/
			 if (tomatch.test(theurl))
					{
						 //window.alert("URL OK.");
						 return true;
					}
			 else
					{
						 window.alert("Please Enter valid URL . ");
						 return false; 
					}
		
	}

}


function validate_blog(){
						
			if(document.getElementById('Title').value=="")
			{
				alert("Please Enter Blog Title");
				document.getElementById('Title').focus();
				return false;
			}
			if(document.getElementById('CatID').value=="")
			{
				alert("Please Select Blog Category");
				document.getElementById('CatID').focus();
				return false;
			}
			if(document.getElementById('Description').value=="")
			{
				alert("Please Enter Blog Description");
				document.getElementById('Description').focus();
				return false;
			}
						
			return true;
		}
		
		function validate_story()
		{
						
			if(document.getElementById('Title').value=="")
			{
				alert("Please Enter Story Title");
				document.getElementById('Title').focus();
				return false;
			}
			if(document.getElementById('CatID').value=="")
			{
				alert("Please Select Story Category");
				document.getElementById('CatID').focus();
				return false;
			}
			if(document.getElementById('Description').value=="")
			{
				alert("Please Enter Story Description");
				document.getElementById('Description').focus();
				return false;
			}
						
			return true;
		}
		
	function show_embedvideo(videoid)
	{
		var url=SiteUrl+"operation.php?action=embed_video&videoid="+videoid;
		ajaxLink(url,"result_embed_video");return true;
	}
	
	function RatePhotoBox(rating,pid,area)
	{
		var url= SiteUrl+"people/people_operation.php?action=rate_photo&photo_id="+pid+"&rating="+rating ;
		ajaxLink(url,area);
	}
	
	function RateVideoBox(rating,vid,area)
	{
		var url= SiteUrl+"people/people_operation.php?action=rate_video&video_id="+vid+"&rating="+rating ;
		ajaxLink(url,area);
	}
	
	function RateMemberBox(rating,mid,area)
	{
		var url= SiteUrl+"people/people_operation.php?action=rate_member&member_id="+mid+"&rating="+rating ;
		ajaxLink(url,area);
	}
	
	function RateEventBox(rating,eid,area)
	{
		var url= SiteUrl+"people/people_operation.php?action=rate_event&event_id="+eid+"&rating="+rating ;
		ajaxLink(url,area);
	}
	
	function RateStoryBox(rating,sid,area)
	{
		var url= SiteUrl+"people/people_operation.php?action=rate_story&story_id="+sid+"&rating="+rating ;
		ajaxLink(url,area);
	}
	
	function show_rating(pid,no)
	{	
		for(i=1;i<=5;i++)
		{	if(i<=no)
			document.images["RateStar_"+pid+"_"+i].src=SiteUrl+"images/star1.gif";
			else
			document.images["RateStar_"+pid+"_"+i].src=SiteUrl+"images/star3.gif";
		}
	}	

