' ;
if(jQuery("#login-dialog").length == 0){
jQuery('body').append(html);
var winH = jQuery(window).height();
var winW = jQuery(window).width();
//Set the popup window to center
var halfheight=winH/2-jQuery(".modal").height()/2;
var halfwidth= winW/2-jQuery(".modal").width()/2;
// winHeight=10;
// $(".modal").css("margin-top", winHeight);
jQuery(".modal").css("margin-left", halfwidth);
}
createBackDrop();
jQuery("#login-dialog").show();
if(jQuery(document).height() > 1500){
jQuery('.modal.fade.in').css("top","2%");
}
}
}
function showLogin() {
jQuery('#loginInner').show();
jQuery('#signup_tiny_help_message').hide();
jQuery('#forgotPassword').hide();
jQuery('#fpwMsg').hide();
jQuery('#signup-dialog').hide();
showLoginPopUp();
}
function showForgotPassword(){
var viewportmeta = document.querySelector('meta[name="viewport"]');
if (viewportmeta) {
viewportmeta.setAttribute('content', 'width=device-width,minimum-scale=1.0');
}
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i) {
document.querySelector('meta[name="viewport"]').setAttribute('content', 'width=device-width,minimum-scale=1.0,initial-scale=1.0');
}
//hide errors if any
jQuery('#login_tiny_help_message').hide();
//check if $.cookie is set or not for remember me functionality
if( jQuery.cookie("unameRemember")==null && jQuery.cookie("passwordRemember")==null) {
jQuery("#login_email_id").val('');
jQuery("#login-password-id").val('');
}
//clear input box
jQuery("#fpwEmailId").val('');
jQuery('#loginInner').hide();
jQuery('#forgotPassword').show();
}
function showSignUp() {
jQuery('#login_tiny_help_message').hide();
jQuery('#login-dialog').hide();
jQuery("#signup-email").val('');
jQuery("#signup-password").val('');
jQuery("#signup-repeat-password").val('');
showSignUpPopUp();
}
function createBackDrop() {
if(jQuery('.modal-backdrop').length == 0 ){
jQuery('body').append('
');
}
if(!jQuery('.modal-backdrop').is(':visible')){
jQuery('.modal-backdrop').show();
}
}
function closeModal(elem) {
viewport = document.querySelector("meta[name=viewport]");
viewport.setAttribute('content', 'width=device-width; initial-scale=0.0; user-scalable=yes;');
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i) {
// $('meta[name=viewport]').remove();
viewport = document.querySelector("meta[name=viewport]");
viewport.setAttribute('content', 'width=device-width; initial-scale=0.0; user-scalable=1;');
}
jQuery('#forgotPassword').hide();
jQuery('#loginInner').show();
jQuery(elem).closest('.modal').hide();
jQuery("#signup-dialog").find(":text").val("");
jQuery("#signup-dialog").find(":password").val("");
jQuery("#forgotPassword").find(":text").val("");
jQuery("#fpwMsg").empty();
removeBackDrop();
viewport = document.querySelector("meta[name=viewport]");
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i) {
viewport.setAttribute('content', 'width=device-width; initial-scale=1.0; minimum-scale=0.0; user-scalable=1;');
}
else{viewport.setAttribute('content', 'width=device-width; initial-scale=1.0; minimum-scale=0.0; user-scalable=yes;');
}
// $('#forgotPassword').show();
}
function removeBackDrop() {
jQuery('.modal-backdrop').remove();
jQuery('#login_tiny_help_message').empty();
jQuery('#signup_tiny_help_message').remove();
}
function format(value) {
value+="";
var rgx = /(\d+)(\d{3})/;
while (rgx.test(value)) {
value = value.replace(rgx, '$1' + ',' + '$2');
}
return value;
}
function showSignUpPopUp(objs,requesttype) {
var popUpwidth = 550;
var width = jQuery(window).width();
if(jQuery(window).height() > 1500){
jQuery('#signup-dialog').css("margin-top","2%");
}
if(width -1){
showBootstrapSignUpPopUp('notActive',requesttype);
}else{
var html = '' +
'
'+
'
'+
'
'+
'
'+
'
'+
''+
'
'+
'
'+
'
'+
'
';
if(jQuery("#signup-dialog").length == 0){
jQuery('body').append(html);
var winH = jQuery(window).height();
var winW = jQuery(window).width();
//Set the popup window to center
var halfheight=winH/2-jQuery(".modal").height()/2;
var halfwidth= winW/2-jQuery(".modal").width()/2;
if(winW 1500){
jQuery('.modal.fade.in').css("top","2%");
}
}
}
jQuery( window ).resize(function() {
var windowH = jQuery(window).height();
var windowW = jQuery(window).width();
winHeight=10;
//Set the popup window to center
var halfwid= windowW/2-jQuery(".modal").width()/2;
jQuery(".modal").css("margin-left", halfwid);
});
var ajaxRequest = null;
function socialSignIn(response,action) {
var scholarIDs = "";
if(jQuery("#hiddenIds").length != 0) {
scholarIDs = document.getElementById("hiddenIds").value;
}
var saveActive = "";
if(jQuery("#saveActive").length != 0) {
saveActive = jQuery("#saveActive").val();
}
// need hack for ajax request
if(ajaxRequest != null){
alert("waiting for previous request to complete.");
return false;
}
var data = "action=" + action +"&saveActive="+saveActive+"&scholarIDs=" + scholarIDs + "&socialresponse=" + encodeURIComponent(JSON.stringify(response));
jQuery('.social-connect-loader img').show();
ajaxRequest = jQuery.ajax({
url: ROOTURL+'/wp-content/themes/collegeresourcenetwork/google_singIn.php',
type: "POST",
data: data,
dataType: "json"
});
ajaxRequest.done(function(msg) {
if(saveActive == "active") {
saveRankingSearchCriteria();
}
eval(msg.steps);
jQuery('.social-connect-loader img').hide();
ajaxRequest = null;
});
ajaxRequest.fail(function(jqXHR, textStatus) {
alert( "Request failed: " + textStatus );
jQuery('.social-connect-loader img').hide();
ajaxRequest = null;
});
return false;
}
/*Google login clientId*/
/*Local client ID*/
//var clientId = '379853129894-ojhr6cpb72oq3ktu89bhed76j60pceig.apps.googleusercontent.com';
/*Live client ID*/
var clientId = '617900169115-earmjc18q6ebovtapeuijafa5bs6agk5.apps.googleusercontent.com';
var scopes = [];
scopes.push('https://www.googleapis.com/auth/userinfo.email');
scopes.push('https://www.googleapis.com/auth/userinfo.profile');
function googleLogin(popupSignUp) {
if(popupSignUp == "bouncePopup") {
_gaq.push(['_trackEvent', 'BounceCampaign', 'Bounce Pop up', 'ButtonClick']);
}
handleAuthClick();
}
function handleAuthClick(event) {
jQuery('.social-connect-loader img').show();
gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: false}, handleAuthResult);
return false;
}
function handleAuthResult(authResult) {
jQuery('.social-connect-loader img').hide();
if(authResult && !authResult.error) {
getAuthDetailsForGoogle(authResult.access_token);
}
};
function getAuthDetailsForGoogle(accessToken) {
if(ajaxRequest != null){
alert("waiting for previous request to complete.");
return false;
}
var data = "access_token=" + accessToken;
jQuery('.social-connect-loader img').show();
ajaxRequest = jQuery.ajax({
url: "https://www.googleapis.com/oauth2/v1/userinfo",
type: "GET",
data: data,
dataType: "json"
});
ajaxRequest.done(function(msg) {
ajaxRequest = null;
jQuery('.social-connect-loader img').hide();
if(msg && !msg.error) {
socialSignIn(msg,"googlelogin");
}
});
}
//var gaJsHost = "https://";// (("https:" == document.location.protocol) ? "https://" : "http://");
//document.write(unescape("%3Cscript src='" + gaJsHost + "apis.google.com/js/client.js?onload=handleClientLoad' type='text/javascript'%3E%3C/script%3E"));
// async load
(function() {
var po = document.createElement('script');po.type = 'text/javascript';po.async = true;
po.src = 'https://apis.google.com/js/client.js?onload=handleClientLoad';
var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(po, s);
})();