/*!
 * JavaScript for web settiing
 * http://graphic-dd.com/
 *
 * Copyright 2011, Manus Onemool
 * Dual licensed under the MIT or GPL Version 1.1 bata licenses.
 *
 * Date: Mon Nov 21 06:36:29 pm 2011 -0500
 */
 $(function(){ // this for css style. Example: $("class or id").css("property","values");
	$("body").css("-webkit-background-size","cover");
	$("body").css("-moz-background-size","cover");
	$("body").css("-o-background-size","cover");
	$("body").css("background-size","cover");	
	
	$(".container").css("background","rgba(255, 255, 255, 0.8)");
	$(".container").css("box-shadow","5px 5px 5px rgba(80, 80, 80, 0.4)");
	$(".container").css("-moz-box-shadow","5px 5px 5px rgba(80, 80, 80, 0.4)");
	$(".container").css("-webkit-box-shadow","5px 5px 5px rgba(80, 80, 80, 0.25)");
	$(".container").css("border-radius","0px");
	
	$(".slide_top").css("box-shadow","5px 5px 5px rgba(80, 80, 80, 0.4)");
	$(".slide_top").css("-moz-box-shadow","5px 5px 5px rgba(80, 80, 80, 0.4)");
	$(".slide_top").css("-webkit-box-shadow","5px 5px 5px rgba(80, 80, 80, 0.25)");
	
	$(".top_bar").css("background","rgba(255, 255, 255, 0.9)");
	$(".top_bar").css("box-shadow","0 0 15px #777");
	$(".top_bar").css("-moz-box-shadow","0 0 15px #777");
	$(".top_bar").css("-webkit-box-shadow","0 0 15px #777");
	
	$(".footer").css("color","rgba(255, 255, 255, 0.7)");
	
	$(".dropdown").css("background","rgba(255, 255, 255, 0.7)");
	$(".dropdown").css("border-radius","0px 0px 0px 0px");
	$(".sub1").css("border-radius","10px");
	$(".license").css("border-radius","15px");
	$(".license").css("background","rgba(153,204,0, 0.8)");
	$(".noImg").css("background","rgba(255, 255, 255, 0.7)");
});
/* check input only numbers */
function IsNumeric(sText,obj){
	var ValidChars = "0123456789.-+ ";
	var IsNumber=true;
	var Char;
	for (i=0; i<sText.length && IsNumber==true; i++){
		Char = sText.charAt(i);
		if (ValidChars.indexOf(Char) == -1){
			IsNumber=false;
		}
	}
	if(IsNumber==false){
		alert("Please enter only number!");
		obj.value=sText.substr(0,sText.length-1);
	}
}
/* This Java for New window open. How to use: use with tag A. Example: onclick="NewWindow(this.href,'name','width','height','yes'); return false" */
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings =
	'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	win = window.open(mypage,myname,settings)
}
/* auto input text focus (name_of_value = value to input form) */
$(function(){
$("input[name^='name_of_value']").keyup(function(event){
	if(event.keyCode==8){
		if($(this).val().length==0){
		$(this).prev("input").focus();  
		}
		return false;
		}		    
		if($(this).val().length==$(this).attr("maxLength")){
		$(this).next("input").focus();
		}
	});	
});
/*!
 Fix textarea max length (#name_of_value = id to input form)
 <textarea name="name_of_value" id="name_of_value"></textarea>
 <span id="now_length"></span>
 */
$(function(){
	var max_length=600; // count of max length
		$("#CFComment").keyup(function(){ // went textarea id = DATA have event keyup
		var this_length=max_length-$(this).val().length; // find the max length
		if(this_length<0){
		$(this).val($(this).val().substr(0,600)); // show max length
		}else{
		$("#now_length").html(this_length+" remaining letters.");		
		}			
	});
});
/*!
 clear text input form.
 Example: <input name="" type="" value="" onFocus="clearText(this); emailriddler.displaypreview()" onkeyup="emailriddler.displaypreview()" /> 
 */
